Evaluate syntax


Rodney

Recommended Posts

Hi

 

I am having a problem with the syntax of evaluate

I can get this expression to work

evaluate(Sites[Site_ID[0]] + "_Pressure1_Current[0]") /10  - where Sites[Site_ID[0]] =NB

I can this expression to work

evaluate(max(NB_Pressure1_Current[0,1000]))/10 - I know I don't need evaluate for this expression but for syntax testing I needed to confirm it works

but I cannot get this expression to work

evaluate(max(Sites[Site_ID[0]] + "_Pressure1_Current[0,1000]"))/10

I'm trying to Substitute "NB" in expression 2 with Sites[Site_ID[0]] from expression 1 so it will work with multiple sites

after a few hours of trying I'm not having much luck in getting the syntax correct.....

your help appreciated!!

Rodney

 

 

 

Link to comment
Share on other sites

thanks got that to work

I have another related syntax issue

I have a button with a set to as the action

if I use exp1 below it works and updates the channel

however I need the expression to be dynamic and update based on what site it is

exp2 does give me the desired string in the result but when I use that expression it won't update the channel

I tried Exp3 but I think that actually evaluates the expression - it does not return the string needed to update the channel

I think I'm close but I just cannot figure out what syntax the expression needs to be

Rodney

 

Button_Exp3.PNG

Button_Exp2.PNG

Button_Exp1.PNG

Link to comment
Share on other sites

The Set To action can only take a channel or variable.  Think of it like the left side of an assignment:

myChannel = 5

You can't do:

sin(myChannel) = 5

and Evaluate() is a function just like sin().

To do what you want, you'll have to use a Quick Sequence and execute.  Something like:

private string datain = system.entryDialog("Enter a value:")
if (!isempty(datain))
   execute(sites[site_ID[0]] + "_Tank_Install_Height[0] = datain")
endif

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.