Tag has been updated, and indexing tag names

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

Tag has been updated, and indexing tag names

Post by jydepower »

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.

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

Re: Tag has been updated, and indexing tag names

Post by jydepower »

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.

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

Re: Tag has been updated, and indexing tag names

Post by jydepower »

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.

Aurimas94
Posts: 6
Joined: Mon Nov 18, 2019 4:12 am

Re: Tag has been updated, and indexing tag names

Post by Aurimas94 »

Hey, I just noticed you have actually asking the same think. Here is the post that I wrote yesterday regarding my problem: http://ixtalk.beijerelectronics.us/view ... 26ab7ab5f7
And I just realized that I could use the same principle as you are instead of having different Tag names I can use one tag with array size of 30 and loop through them...
But anyway to have lightweightTag indexing might be useful however there is no solution at the time that I could think of.
Best regards.

Aurimas94
Posts: 6
Joined: Mon Nov 18, 2019 4:12 am

Re: Tag has been updated, and indexing tag names

Post by Aurimas94 »

Check the most recent post of mine, I have solved the issue.

Post Reply