Expression binding issue for 2 conditions

Hi ,

I have 2 tags

tag 1 value = 220 (float)
tag 2 = true (Boolean)

i have created a expression tag and data type as boolean

if tag 1>0 and tag 2 == true i want to return true
else return flase

how to write for this one

i have tired code like this but this not working

Create a binding expression as shown below. Note that the expression language does not use == syntax and uses && for the logical AND operator (and & for the bitwise AND operator). See Expression Language and Syntax - Ignition User Manual 8.1 - Ignition Documentation for details.

({[default]TestTags/tag 1} = 220) && {[default]TestTags/tag 2}

Tip: please use </> code formatting button when posting code or for inline code enclose it between ` backticks.

if({[MQTT Engine]Edge Nodes/Montreal/Line/Common/Production Data/Mixing n Forming/FormingBelt_Speed.value} > 0) && {[MQTT Engine]Edge Nodes/Montreal/Line/Common/Production Data/Mixing n Forming/Mixer_Running.value} !=0,1,0)

I have tired like this… still getting error configuration error

If you hover over the error message you will get further details.

Expression language allows breaking code over several lines. You can use this to your advantage to make the code readable. When you do you will see the following:

	{[MQTT Engine]Edge Nodes/M ... /FormingBelt_Speed.value} > 0) 
	{[MQTT Engine]Edge Nodes/M.../Mixer_Running.value} !=0,

Note that you have a closing ) on line 2 with no opening (.

Is the n part of the actual tag or is it supposed to be a number?

1 Like

Note that you have a closing ) - this is the issue i have removed the bracket working now thanks

You should simplify your expression into the format that I posted. It is much easier to read. This is all you need:

{[MQTT Engine]Edge Nodes/M ... /FormingBelt_Speed.value}
{[MQTT Engine]Edge Nodes/M.../Mixer_Running.value}

Boolean operations return true for non-zero values so you don’t need either of your > operators.

Don’t forget to mark the question as solved.

1 Like