Charmed Quark Systems, Ltd. - Support Forums and Community
IF statement not working - Printable Version

+- Charmed Quark Systems, Ltd. - Support Forums and Community (https://www.charmedquark.com/vb_forums)
+-- Forum: General Discussion (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=3)
+--- Forum: CQC Support (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=9)
+--- Thread: IF statement not working (/showthread.php?tid=10209)



IF statement not working - EST - 03-28-2017

I have done If System::Equals many times before but I am stumped on why this will not run.

Simply, I have a triggered event off my phone when connected to my network to fire a tasker task via the autoremote function.  

BUT

If System::Equals(NetworkMonitor.EricPhone, True, No Case)

   Do global action stuff for tasker if connected to home network

Else

  Do global action stuff if phone not connected to home network.

End

This does not work...Phone is connected to network and field is True but it skips the If True section and goes to the Else line.  I then added and If False statement to the Else line to see if the False would fire...nope.

Here is the full code:
If 
System::Equals
    P1=NetworkMonitor.EricPhone
    P2=True
    P3=No Case

System:Big GrinoGlobalAct
    P1=/User/Misc/SendARMsgYps
    P2="recloopvar","run"

System::WaitTimer
    P1=0
    P2=5000

System:Big GrinoGlobalAct
    P1=/User/Misc/SendARMsgYps
    P2="recloop","on"

Else

If 
System::Equals
    P1=VarDrvr.Text
    P2=False
    P3=No Case

System:Big GrinoGlobalAct
    P1=/User/Misc/SendARMsgYps
    P2="recloopvar","stop"

Else

End

End




Running version 5.07.  

Thoughts?


RE: IF statement not working - Dean Roddey - 03-28-2017

It's this:

Code:
If System::Equals(NetworkMonitor.EricPhone, True, No Case)

You are literally comparing the name of the field to True. You need to do this:

Code:
If System::Equals($(NetworkMonitor.EricPhone), True, No Case)

That will resolve to the actual value of the field. Where possible using the action testing dialog, which will show you the actual fleshed out results of the action. You would have seen it comparing "NetworkMonitor.EricPhone" and "True" in that If statement.

Also, use the helper button or the action parameter popup menu to select fields. It will give you the option to insert the name or a reference to the name, which makes it quick and easy to do.


RE: IF statement not working - EST - 03-29-2017

Dang...that gets me everytime. Thanks. I should have known that.