Redlion complex editor

UKB

Member
Join Date
Aug 2014
Location
UK
Posts
56
Hiya -

I've got a mitsi plc and I'm using a redlion graphite to display some values and enter data etc..
I have been trying to use the complex editor tool to display some text based information based on the value of a register in the plc. The intention is to have some descriptive information to tell the operator what the machine should be doing at a certain step of the sequence.
I've made a tag and linked it to a D register in the plc, and I have called the tag in this instance "MAIN_SEQUENCE"
Here is the code I have tried; My idea was that if the register has a value of 0 I would display on the redlion screen "step 1". If the register has a value of 5 then the redlion would display "step 2" and so on etc...
What appears to happen is with a register value of 0 the correct text is displayed, however at all other register values I seem to have all the text displayed at once.

Any help would be obliged,

if (MAIN_SEQUENCE == 0)
return "STEP 1";

else { if (MAIN_SEQUENCE==5)
return "STEP 2";

if (MAIN_SEQUENCE==10)
return "STEP 3";

if (MAIN_SEQUENCE==15)
return "STEP 4";

if (MAIN_SEQUENCE==20)
return "STEP 5";

if (MAIN_SEQUENCE==25)
return "STEP 6";
 
Another way to do this would be to make the assignments at the tag format itself. On your tag, on the Format tab for Format Type, choose Multi-State, select the number of states and fill in the blanks for Data and corresponding text. Then when you use the tag on a display page, the text will appear by default (as long as you leave the object set to get Format from tag).

You can always override the object to use the numeric format if you want to display the actual number somewhere in the application.

This method is much cleaner than using a script as well as being global by default so you can set it up and make changes in one place.
 
Another way to do this would be to make the assignments at the tag format itself. On your tag, on the Format tab for Format Type, choose Multi-State, select the number of states and fill in the blanks for Data and corresponding text. Then when you use the tag on a display page, the text will appear by default (as long as you leave the object set to get Format from tag).

You can always override the object to use the numeric format if you want to display the actual number somewhere in the application.

This method is much cleaner than using a script as well as being global by default so you can set it up and make changes in one place.

Definitely the best way to go!
 
This is a far better idea. Thanks alot guys, really appreciate that.
many thanks,

UKB
 
In case for some reason you were still considering coding it you should use the "switch statement":

Switch (MAIN_SEQUENCE){

Case 0:
return "STEP 1";
Break;


Case 5:
return "STEP 2";
Break;


Case 10:
return "STEP 3";
Break;


Case 15:
return "STEP 4";
Break;


Case 20:
return "STEP 5";
Break;


Case 25:
return "STEP 6";
Break;
}

But like was already said the Multi-Statement is probably the better way to go.

Good luck
 

Similar Topics

hi, I am new to Redlion Crimson Software and I making a customize faceplate for PID. I have placed two buttons one for Auto and one for Manual...
Replies
5
Views
3,052
I have a bevel button on a crimson 3 G15 panel. I am trying to use the 2 state color animation to change button colors based on tag data. I have...
Replies
5
Views
4,959
Hi, I got a question for those who know a bit more about the RedLions than I do. Can you create a Data Log on a Complex Data Tag? I've got a...
Replies
3
Views
4,118
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
149
Hi, I have a complex database in Crimson 3.0 and in one of the display pages I am trying to get a tag to show the sum of several other tags. The...
Replies
3
Views
182
Back
Top Bottom