Im creating a program that is going to be similar to an HMI.
It will update the tags from a web service.
I have a XML file with all available tags I can receive from the web service.
Every tag has its unique ID, Name, Description, Type of variable and so on.
It can look something like this:
ID: 1
Name: Machine.State.RPM.Actual
Description: Actual Machine RPM
Type: float
Unit: RPM
I do not want to add all tags manually so I figure doing it by using XMLSAX.
When all tags are added Im thinking using the ID number to find the tag of interest,
Label1.Text = Tags(ID).ActualValue
or
Label1.Text = Tags(Label1.Tag).ActualValue & Tags(Label1.Tag).Unit
What will be the best practice to declare all tags into variable structure?
The Tag().Actual can be string, integer, float, unsigned or DateTime.
When I receive an update from the web service it comes as String and also with information of variable type.
Or should I always declare the Tags().ActualValue as string and deal with it when it needs to be converted?
Also when I receive an update it wont say the ID number of the tag, just the name of it. So to find where I should update inside the Tags() variable I need to make a loop that looks for a match at Tags(index).Name
I hope my explanation make sense or I will try it in an other way.
/J