double GetTagValue(string TagName);
string GetTagValue(string TagName);
void GetTagValue(string TagName, string value); - Note: This format is not available from version 10.3.1 onwards
Reads the value of the given tag or member. Instead of this function, you can use a = $TagName.
Parameters
string TagName - The name of the tag for which you want to get the value (Tag.member format can also be used. See tag members for more details.)
string value - Buffer to store the read string. This refers to the buffer that will store the string type of the Tag you want to read. You can use a char array or a string tag. (This argument was allowed until version 10.3.0, but it is not available from version 10.3.1 onwards.)
Return Value
The return value is a number if the value you want to get is not a string and is of type double. (Before version 9.5.2)
The return value is a string if the tag is a string tag; otherwise, the return value is a number. (From version 9.5.2 onwards)
Example 1
@GetTagValue("ST_0000", buf);
Description: Reads the current value of ST_0000 and stores it in the buf array. (This format is not supported from version 10.3.1 onwards. You must use it as in Example 4.)
Example 2
value = @GetTagValue("AI_0000.hihi");
Description: Reads the hihi member value of AI_0000 and assigns it to value.
Example 3
for(i=0; i<10; i=i+1){
@sprintf(buf, "AI_00%02d", i)
// The above function stores AI_0000 in buf when i=0, AI_0001 in buf when i=1, and so on, as the for loop executes.
value = @GetTagValue(buf);
// Stores the value of the tag stored in buf (AI_0000's value when i=0, AI_0001's value when i=1, etc.) in value sequentially.
}
Example 4 (Supported from version 9.5.2 onwards. From version 10.3.1 onwards, this format must be used.)
buf = @GetTagValue("ST_0000");
Description: Reads the current value of ST_0000 and stores it in the buf array. (Same function as in Example 1)
Related Helps