Red Lion Crimson 3.0 – Problems with 'i' in TAG arrays.

Dyslexicbloke

Member
Join Date
Jul 2011
Location
Leek, ST13 7ER
Posts
34
Hi folks,
I have a couple of array tags which I am attempting to build a schedule application with.
I have two spaciffic problems.

1.
Using the system variable 'i' to modify each elliments label ( Label: ="strScheduleDef"+AsText(i+1), works just fine giving a label of strScheduleDef1 for strScheduleDef[0]
but I cant use the label to get an index or asign values ......

strScheduleDef1:="New String Value";
Asks to create a new TAG when it is compiled.

GetTagIndex("strScheduleDef1") returns -1 (IE it fails)
GetTagIndex("strScheduleDef") returns a valid index but isnt actually a qualified TAG as the elliment ordinal is missing.
The upshot, I cant use:-
SetStringTag(GetTagIndex("TagLabel")","New String Value")
If the TAG involved is an array.

2.
The second issue is with code in the onWrite property.
As I understand it from the manual 'i' should be equal to the particular elliments ordinal, as it is above in the label assignment.
In practice I just get a huge int value that I cant make any sense of.

I am probably just being silly but I would apriciate someone pointing ou exactly how silly!!

Thanks folks ... looking forward to being educated
Al
 
Am I doing something unusual here, I am supprised that there arn't any comments.
Should I be looking at some other structure or aproach.

Realy struggling folks, any input would be welcome.

I hope you will forhive me lifting this thread, I'l only do it this one time.

Thanks
Al
 
Yes, I think you are doing two things that are unusual, if I understand your intentions correctly:
1. System Variable "i"? I am going to guess you meant local variable?

1a. Dynamic (runtime) tag creation or variable renaming? I would be somewhat surprised if this is possible with Crimson 3.0 but I am not qualified to answer for sure. It is unusual, if not illegal, to try to reference a tag or variable that has not been defined. I think that the label is not the name of the variable, and can't be used to reference it. The variable name must be used. Yes, you can modify the label associated with the variable StrScheduleDef, but to change its value, your assignment should be StrScheduleDef:=MyNewValue. To change its label, your assignment should be StrScheduleDef.label:=MyNewLabelString

Crimson 3 Manual said:
TAG ATTRIBUTES
Tags within Crimson are rich objects that define various common properties…
• A tag’s label is a translatable, human-readable string used to automatically label
data fields referring to this data item. It is also used by the Web Server and the
Data Logger to label associated data items.
---

TAG PROPERTIES
Data tags have certain properties than can be accessed by following a tag name with a period and then with the name of the required property. The following properties are defined...


PROPERTY DESCRIPTION DATA TYPE
Name The tag’s name. String.
AsText The tag’s value formatted as text. String.
Label The tag’s Label property. String.
Desc The tag’s Description property. String.
Prefix The prefix defined by the tag’s format. String.
Units The units defined by the tag’s format. String.
SP The tag’s setpoint property. Same As Tag.
Min The tag’s lower data entry limit. Same As Tag.
Max The tag’s upper data entry limit. Same As Tag.
Fore The tag’s current foreground color. Integer.
Back The tag’s current background color. Integer.


1b. redimming arrays is unusual ... not in and of itself ... but in the context of industrial controls software ...

2. On Write is an event that occurs each time the variable is changed (I assume only by the Crimson device). Not sure again where "i" comes from in your question.

Describe the forest, now that we have seen these trees, perhaps you are using a "silly" method. I once wrote my own string compare logic for RSLogix500, and posted it here for advice...it was like twelve rungs, and Alaric thankfully popped in and said why don't you just use ASC? So I didn't waste any more time trying to streamline it...Doh!!!
 
Last edited:
Thanks I absolutly agree with your reasoning but none the less Crimson seems to work a little differently.
The FindTagIndex() function is definatly looking at the Label not the Name and that is what is failing when Label is dynamic.
See below re dynamic Label in arrays.

From the manual RE ' i ' in array properties :-
ARRAY PROPERTIES
Many of the properties of array tags can be made variable based upon the exact element of the
array being referenced. To achieve this, a system property called
i is set to the element index
during the evaluation of those properties. For example, the Label property could be set to
="Element " + AsText(i+1) to label the array elements Element 1, Element 2 etc.
This feature can be used with the following properties…
The tag’s label.
The tag’s scaling values.
The tag’s setpoint.
The tag’s limits.
The tag’s On Write property.
The tag’s event labels.
The tag’s event and trigger values and hysteresis settings.
The tag’s trigger actions.
Note that triggers and events are evaluated separately for each element of the array for which
they are configured, allowing several events or triggers to be created at once. The only
limitation to this feature is that alarms and events only operate for the first 256 elements of
the array. Triggers operate for all elements, regardless of the size of the array.
======================================================
I think, based on the above, that what I am trying to do should work.
Either there is a bug, my syntax is wrong or the manual is wrong. What I dont know is which of those statements is true.
The referencing of array elliments by label is just a nice to have and dosnt make much difference but the ' i ' in OnWrite not working is a big handycap.

Al
 
Very interesting, I didn't know about the paragraph you quoted. I will have to defer to the Red Lion guys for the answer, and I expect they will come along and see this within a day or two at most. You should call them, and send a copy of the database for a quicker answer though.

Paul
 
Dyslexicbloke and OkiePC

Regarding issue #1, this is a documentation error and we will get this resolved in the manual. The FindTagIndex function works from the tags name and not the label.

We are looking at the OnWrite issue and we will let you know what is going on.

Thanks
Jeremy
 

Similar Topics

How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
126
Hi, I am trying to increase the size of the user login pop up using a Red Lion CR1000 7” HMI with Crimson 3.1 software. The login pop up is very...
Replies
2
Views
691
Hello, We are currently running a bunch of g310's connected to their SLC5 PLCs through ethernet. I've attempted to upgrade the program from 2.0...
Replies
1
Views
1,138
Hi I have been using Red Lion products for some time, I had a thought over the bank holiday weekend, As you do. It would be nice if whenever a...
Replies
4
Views
1,030
Well, I have yet another question for the great minds on this forum! We have a red lion HMI for one of our machines and every time I hook my...
Replies
11
Views
1,696
Back
Top Bottom