Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Tag has been updated, and indexing tag names
PostPosted: Wed Aug 19, 2015 12:50 pm 

Joined: Thu Aug 16, 2012 9:33 am
Posts: 26

Offline
Hallo.

Im working on a project where I need to know if the following two questions are possible:

1) Is it possible to somehow index tag names for looping.
2) Telling when a specifig tag has been updated from the controller.

A bit about the project:
I have 350 array[50] of int tags in both the ix panel and the controller.
Each array is a recipe with 50 elements.
A MySql server have been made with the same structure as the array tags.
The idea is to update the values in the database with one of the 350 arrays when needet.
The reason i use a MySql server, and not the build in recipe handler, is i want to display results on a php webserver.
Basically im using the ix panel to transfer tags between the controller and the MySql server.

This works fine, but the C# have been made in a very manual way.
For now i have made 350 queries, because i have no idea how to index the tag name. Which makes the 1st question.

1)
Lets say the tag names are Array1, Array2, Array3.. etc. Is it then possible to somehow index the tag name, so i could loop through Array[1], Array[2], Array[3] etc.?

How it works in pratice:
User have a screen where they have to chose the recipe number 1-350
There i have my pointer. User gets 50 input fields (array[50]). When done editing, user hit save and it goes like this:
The 50 input fields are updated in the controller, in the correct array[Recipe number]. The controller activates the MySql query in the ix panel. Which brings me to the 2nd question.

2)
I want to know if it is possible to tell if a tag has been updated/pulling done?
For now ive set all the 350 arrays for Always Active. This again works fine, but makes alot of unnecessary trafic. And i have to rely on timers, to make sure the ix panel is done pulling, before i make the MySql query. Maybe i could see if the last element in the array is updated(in case its updates in that order), and rely on that to know the whole array has been updated.
If so i could do a Tag.Read -> Wait for update -> MySql query.

Thanks in advance.


 Profile  
 
 Post subject: Re: Tag has been updated, and indexing tag names
PostPosted: Thu Aug 20, 2015 12:21 pm 

Joined: Thu Aug 16, 2012 9:33 am
Posts: 26

Offline
I have solved question 1) by reducing the 350 arrays to 1.
Suddently i came to think of, that i dident need 350 arrays. Instead i just use 1 array, to carry the data from controller to MySql database. The recipe number (pointer) is used in the WHERE statement in the MySql query.
This reduced my tag pulling from 350*50 to 1*50, so just perfect.

Question 2) still remains. I would love to know, if its possible to detect, when a pull is done.


 Profile  
 
 Post subject: Re: Tag has been updated, and indexing tag names
PostPosted: Fri Aug 21, 2015 1:15 pm 

Joined: Thu Aug 16, 2012 9:33 am
Posts: 26

Offline
Question 2) has been solved as well.
Beijer support told me that when using a Tag.Read event. The "code" wont continue until the tags are updated.

That means:

Globals.Tags.Array1.Read(); (next line will not be read until all the array elements are updated).
MySql query goes here.

I have testet it and it seems to work. I cant actually see that they are updated, but have to count on what support says is correct.
Anyways all tag values shows up in the database, so looks fine.


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron