Steve_D
Member
To all you Citect Gurus..... I have a function that uses a trend tag which is passed into the function as a string (i.e. the name of the tag is a string (e.g.FT1000) I find the min value over a trend period but I want to return the data into the tag FT1000_min
If I use the text FT1000_min I get the result I want in FT1000_min, but what I want to is do make the name of this tag to be the name of the passed in tag and then add "_min" to allocate the data to the _min tag.
In short
This works....
GetTrendFileData(STRING sTrendTag, INT iHours)
STRING sPeriod = TrnInfo(sTrendTag, 2);
TrnGetTable(sTrendTag, 0, 0, 100, rFileData[0], 1);
FT1000_Min = TableMath(rFileData, 100, 0, 0)
but this doesnt, even though when I call the function with sTrendTag as "FT1000"
GetTrendFileData(STRING sTrendTag, INT iHours)
STRING sPeriod = TrnInfo(sTrendTag, 2);
TrnGetTable(sTrendTag, 0, 0, 100, rFileData[0], 1);
sTrendtag + "_Min" = TableMath(rFileData, 100, 0, 0)
The bottom lines are the only issue here, if sTrendTag is FT1000 wont the bottom one work?
How do you indirectly reference a tag name?
Sorry its so confusing...but its confusing..
If I use the text FT1000_min I get the result I want in FT1000_min, but what I want to is do make the name of this tag to be the name of the passed in tag and then add "_min" to allocate the data to the _min tag.
In short
This works....
GetTrendFileData(STRING sTrendTag, INT iHours)
STRING sPeriod = TrnInfo(sTrendTag, 2);
TrnGetTable(sTrendTag, 0, 0, 100, rFileData[0], 1);
FT1000_Min = TableMath(rFileData, 100, 0, 0)
but this doesnt, even though when I call the function with sTrendTag as "FT1000"
GetTrendFileData(STRING sTrendTag, INT iHours)
STRING sPeriod = TrnInfo(sTrendTag, 2);
TrnGetTable(sTrendTag, 0, 0, 100, rFileData[0], 1);
sTrendtag + "_Min" = TableMath(rFileData, 100, 0, 0)
The bottom lines are the only issue here, if sTrendTag is FT1000 wont the bottom one work?
How do you indirectly reference a tag name?
Sorry its so confusing...but its confusing..