Facility Control

 View Only
  • 1.  Multiple values in a if

    Posted 11-12-2018 19:31

    Hello!

    I am wondering if there is a way to say that an IF needs to be three different values to be true? I have tried in visual logic but i understand that it isn't that easy.

    Best Regards
    Sondre



  • 2.  RE: Multiple values in a if

    Posted 11-13-2018 21:09

    Visual Logic presently only supports simple if statements. It is fairly simple to provide such a conditional in in raw ogscript. If you would like to use visual logic for everything, you could write a utility function to run the equality check (or whatever check you require) on 3 different variables.

      <abs contexttype="opengear" id="_top">
    <meta>
    <params>
    <param access="1" maxlength="0" name="v1" oid="v1" type="STRING" value="asdf" widget="text"/>
    <param access="1" maxlength="0" name="asdf" oid="asdf" type="STRING" value="asdf" widget="text"/>
    <param access="1" maxlength="0" name="v2" oid="v2" type="STRING" value="asdf" widget="text"/>
    <param access="1" maxlength="0" name="v3" oid="v3" type="STRING" value="asdf" widget="text"/>
    </params>
    </meta>
    <meta>
    <api>function equalityCheck(v1, v2, v3)
    {
    if (v1 == v2 &amp;&amp; v1 == v3)
    {
    return "true";
    }
    return "false";
    }</api>
    </meta>
    <button buttontype="push" height="97" left="19" top="72" width="168">
    <task tasktype="ogscript">


    /*! block id=1003,1002,1006,1007,1008,1004,1005 !*/
    if (equalityCheck(params.getValue('v1', 0), params.getValue('v2', 0), params.getValue('v3', 0)) == "true")
    {
    ogscript.debug("EQUAL");
    } else {
    ogscript.debug("NOT EQUAL");
    }
    /*!!
    &lt;block id="1003" type="if" x="556" y="10" w="268" INPUT1="ID:1002" OPERATION="equals" INPUT2="true" TRUE="ID:1004" FALSE="ID:1005" IGNORE="" /&gt;
    &lt;block id="1002" type="function_equalityCheck" x="283" y="10" w="243" v1="ID:1006" v2="ID:1007" v3="ID:1008" /&gt;
    &lt;block id="1006" type="param__top&amp;amp;v1 (v1)[0]" x="10" y="10" w="243" SET="" /&gt;
    &lt;block id="1007" type="param__top&amp;amp;v2 (v2)[0]" x="10" y="72" w="243" SET="" /&gt;
    &lt;block id="1008" type="param__top&amp;amp;v3 (v3)[0]" x="10" y="134" w="243" SET="" /&gt;
    &lt;block id="1004" type="ogscript_debug" x="1127" y="60" w="243" MESSAGE="EQUAL" /&gt;
    &lt;block id="1005" type="ogscript_debug" x="854" y="100" w="243" MESSAGE="NOT EQUAL" /&gt;
    !!*/
    /*!!&lt;checksum&gt;9277c292769cca1938b5c7c55ee15769&lt;/checksum&gt;!!*/</task>
    </button>
    <param expand="true" height="39" left="20" oid="v1" top="13" width="164"/>
    <param expand="true" height="36" left="199" oid="asdf" top="16" width="141"/>
    <param expand="true" height="36" left="350" oid="v3" top="15" width="129"/>
    </abs>


    #DashBoard