Legacy Hardware and Apps
Compound IF statement

When using channel variables, does the DT800 allow the use of compound if statement e.g.

IF (1CV=2 && 2CV=7){[3CV=1CV/2CV]}

If so what general form does it have

When using channel variables, does the DT800 allow the use of compound if statement e.g. ```` IF (1CV=2 && 2CV=7){[3CV=1CV/2CV]} ```` If so what general form does it have

Good afternoon Ian,

Yes you can chain If and Alarm statements.
A couple of points to cover first.

  1. An IF statements is just an ALARM statement by another name.
  2. We have no = statement. An = when comparing an analog value means it would have to exactly match to the very last decimal place. This can't happen in reality so we have < Less than and > Greater than or equal to.
IF(1CV><2,2.1)AND
IF(2CV><7,7.1)"Some text"{[3CV=1CV/2CV]}

There is another way and that is to use boolean logic, we also have logical operators available to us

These are,
AND (If A is true (1) and B is true (1) = Result is true (1))
OR (If A is True (1) or B is True (1) = Result is True (1))
XOR (If A is true (1) or B is True(1) but not both = Result is true (1)
NOT (If A is true (1) then A is not true (0) Inverse logic)
As well as comparative operators;

We also have comparision operators.

< (Less than)
<= (less than or equal to)
= (Exactly equal to)
>= (Greater than or equal to)
> (Greater than)

For example you could also use

4CV=(1CV=2)AND(2CV=7)
IF(4CV>0.5){[3CV=1CV/2CV]}

Cheers,
Roger

Good afternoon Ian, Yes you can chain If and Alarm statements. A couple of points to cover first. 1. An IF statements is just an ALARM statement by another name. 2. We have no = statement. An = when comparing an analog value means it would have to exactly match to the very last decimal place. This can&#039;t happen in reality so we have &lt; Less than and &gt; Greater than or equal to. ```` IF(1CV&gt;&lt;2,2.1)AND IF(2CV&gt;&lt;7,7.1)&quot;Some text&quot;{[3CV=1CV/2CV]} ```` There is another way and that is to use boolean logic, we also have logical operators available to us These are, AND (If A is true (1) and B is true (1) = Result is true (1)) OR (If A is True (1) or B is True (1) = Result is True (1)) XOR (If A is true (1) or B is True(1) but not both = Result is true (1) NOT (If A is true (1) then A is not true (0) Inverse logic) As well as comparative operators; We also have comparision operators. ```` &lt; (Less than) &lt;= (less than or equal to) = (Exactly equal to) &gt;= (Greater than or equal to) &gt; (Greater than) ```` For example you could also use ```` 4CV=(1CV=2)AND(2CV=7) IF(4CV&gt;0.5){[3CV=1CV/2CV]} ```` Cheers, Roger
40
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft