Evaluate syntax


Recommended Posts



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!!





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






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")



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.