Search and Replace

Ok, I have created a conveyor belt which I have individual png’s drawn for each belt segment. I have then created a Dynamic property for each belt which I have tied to a PLC tag and used an expression to create a range of numbers to change the belt color accordingly using a style. I then have an individual line (All belts for one system) in a container which I can then copy the container to add to an overview

I have it working great and it looks good for the first line and I need to do 7 more lines now. I stared with line 4 and am now going to create line 1 so I created a new container for line one … copied line 4 into the new container … moved a few lines around and now I am going through the tedious process if changing all the expressions to point to the correct tags. Is there a way to do a global search and replace on a unigue string.

For example I have one belt listed below … this expression is attached to each belt and the only thing to change is T1-01, T1-02, T1-03 etc … I have about 30 belts per line.

If I could search the T1 and replace it with T4 for an entire container it would save me a bunch of time.

The Dynamic Property I created I called ColorTag and tied the following expression to it.

if({[ROC_5911001]T1-03}>134217727,100, if({[ROC_5911001]T1-03}>67108863,90, if({[ROC_5911001]T1-03}>4194303,80, if({[ROC_5911001]T1-03}>1048575,100, if({[ROC_5911001]T1-03}>524287,40, if({[ROC_5911001]T1-03}>262143,61, if({[ROC_5911001]T1-03}>131071,70, if({[ROC_5911001]T1-03}>2047,60, if({[ROC_5911001]T1-03}>511,50, if({[ROC_5911001]T1-03}>63,51, if({[ROC_5911001]T1-03}>31,100, if({[ROC_5911001]T1-03}>15,30, if({[ROC_5911001]T1-03}>7,20, if({[ROC_5911001]T1-03}>3,40, if({[ROC_5911001]T1-03}>1,11, if({[ROC_5911001]T1-03}>0,10,0))))))))))))))))

Any suggestions would be greatly appreciated !

FYI the color Style which corresponds with the above expression looks like this …

"ColorTag","animationIndex","animationDuration","tintColor" "0","0","1000","color(128,128,128,255)" "10","0","1000","color(0,217,0,255)" "11","0","1000","color(128,128,128,255)" "11","1","1000","color(0,217,0,255)" "20","0","1000","color(0,0,0,255)" "30","0","1000","color(255,0,255,255)" "40","0","1000","color(255,140,0,255)" "50","0","1000","color(255,255,255,255)" "51","0","1000","color(128,128,128,255)" "51","1","1000","color(255,255,255,255)" "60","0","1000","color(255,255,0,255)" "61","0","1000","color(128,128,128,255)" "61","1","1000","color(255,255,0,255)" "70","0","1000","color(71,255,255,255)" "80","0","1000","color(0,0,217,255)" "90","0","1000","color(172,95,0,255)" "100","0","1000","color(255,0,0,255)" "101","0","1000","color(128,128,128,255)" "101","1","1000","color(255,0,0,255)"

Chris

First of all: search and replace is certainly a feature that would be nice, and that we will add in good time.

But, in the meantime, this is precisely what indirect tag bindings and the tag() expression are great for. On your container, have a dynamic property called LineNum that would be 1,2,3,4, etc. Then change your expression to be more like this:

OPTION 1: Use the tag() expression

if(tag("[ROC_5911001]T"+{RootContainer.MyLine.LineNum}+"-03")>134217727,100, if(tag("[ROC_5911001]T"+{RootContainer.MyLine.LineNum}+"-03")>67108863,90, if(tag("[ROC_5911001]T"+{RootContainer.MyLine.LineNum}+"-03")>4194303,80... (etc)

OPTION 2: Use indirect or direct tag bindings
Since you have the same tag in that expression many times - extract it out into a dynamic property using a tag binding (or an indirect tag binding using the “LineNum” idea from option 1 as the indirection parameter), and reference that property in this expression so there is less to change when you copy the container.

Hope this helps,

Oh thats great … I’ll set up a BeltNum on each belt as a dynamic property and do the same thing so for each container I copy once I change the container to match the line the tags should line up just fine.

:prayer: THANKS A BUNCH !!! :prayer:

I have begun my celebrations prematurely …

Here’s the expression I used

if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>134217727,100,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>67108863,90,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>4194303,80,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>1048575,100,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>524287,40,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>262143,61,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>131071,70,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>2047,60,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>511,50,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>63,51,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>31,100,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>15,30,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>7,20,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>3,40,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>1,11,
if(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01")>0,10,0))))))))))))))))

Which I have defined LineNum as an integer and simply put the number 4 … I can tie to that with another dynamic property and it returns a 4 however I now get the following error.

The example in help shows spaces around the “+” so I tried those …

I know I’m close …

Sorry for the board spam …

This worked … thought I should update the thread …if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>134217727,100, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>67108863,90, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>4194303,80, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>1048575,100, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>524287,40, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>262143,61, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>131071,70, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>2047,60, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>511,50, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>63,51, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>31,100, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>15,30, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>7,20, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>3,40, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>1,11, if(toInt(tag("[ROC_5911001]T"+{RootContainer.System.LineNum}+"-01"))>0,10,0))))))))))))))))

Yeah, sorry I forgot to mention that you’d need to cast it.