Crimson 3.2 Set String Tag for Redlion CR3000

hoguegregplc

Member
Join Date
Aug 2023
Location
McKinney, Texas
Posts
10
Action On Release command Set(ConveyorPopup,ConveyorPop_1) rejected w/ string tags.

SetStringTag(index, data) wants an index.

How does one pass a string value to populate a text box?
 
Have to be careful here because I use Crimson 3.1, not 3.2, though I think that it will be 3.1 that you are using for programming a CR3000.

In the top picture, if I wanted a Text box to display a variable I would just drag a Tag in to the Text box.

Often I don't use Text boxes to display text, so in the middle picture I right clicked a Rectangle and added Data, then it can display a string Tag.

In the bottom picture, using Crimson scripting language you can just use the 'equals' sign to copy one string to another. Though the scripting language is 'C' like, it has been tweaked to make things easier to use. Though I just used actual string, it can equally be a string Tag that is copied. If you needed a Tag and a string in one, you use the + sign. So it could be:
string2 = string1 + " C " + anotherString;

Crimson strings.JPG
 
Action On Release command Set(ConveyorPopup,ConveyorPop_1) rejected w/ string tags.

SetStringTag(index, data) wants an index.

How does one pass a string value to populate a text box?

I used properties on the tag to help in creating custom values or dynamic labels for pages. you can access a tags .Name, .AsText, .Label, .Desc, .Min, .Max etc. these are quite handy for making dynamic labels or feedback on screen.
MyTag.Label if populate on the Tag Properties can be use dynamically concatenated (As Bryan showed above with C Script).

The Crimson 3.2 Software Guide and Crimson 3.2 Reference Guide are valuable references for Crimson.
Software Guide
Reference Guide


As to how to use the SetStringTag(index, data) function.

The SetStringTag function requires a Tag Index number (on the properties page for the tag that you wish to upper right corner of the window... "Tag 0, Tag 1, etc" see attached image.

You can use this number 0, 1, 2, etc. for the index. then a tag or other string constant for the "data" argument.
SetStringTag(0,"my text"); // Works if Index 0 tag is String type

or you can call FindTagIndex with the text name of your String type Tag...
SetStringTag(FindTagIndex("MyStringTag"),"my text"); // finds tag by name, returns index to SetStringTag's index argument


Regards,
Patrick

2023-09-07_07-41-14.jpg
 
I downloaded the latest version, and you are right, it does now support the CR range. Also had a quick play, and everything I wrote above still works.
 
...

How does one pass a string value to populate a text box?

Depending on the situation, a tag formatted for multistate with all the right states filled in with text can be the simplest way to go. You can even use a numeric memory tag with the data source set to complex and put any scripting there in order to create a multistate tag that represents the status of a machine.

Here's the data source:

tag 1.png
 
In this case, since I had 24 of these wells and several other pumps with the same or similar status info to display so I used indirection for the format (Format Type: Linked, Format Like)

tag 2.png
 
Last edited:
Here's the common tag I used for all the pumps on this system.
It's formatted multi-state.
I did the same with the colors tab (not shown) so that any tag formatted like this one will show the text and the colors from this tag. If I need to change all of them or add a new state, I can do it here in one place.

tag 3.png
 
Last edited:

Similar Topics

Has anyone successfully used tags to set up the SMTP transport and authentication settings through the HMI after start up? The fields seem to take...
Replies
5
Views
2,376
Merry Christmas to everyone!! Working on a prototype system using a Click PLC and a Red Lion G306. I am trying to set a bit in the PLC when I am...
Replies
7
Views
2,102
Hello all, I've been enjoying learning by lurking on this site and am hoping for some help going in the right direction. Working with crimson...
Replies
2
Views
3,554
Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
4
Views
124
Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
5
Views
229
Back
Top Bottom