Rule ignored if parameter condition is equal = false

Ask general questions here.
qa-auto
Posts: 32
Joined: Mon Aug 05, 2019 10:46 pm

Rule ignored if parameter condition is equal = false

Post by qa-auto » Thu Sep 05, 2019 3:26 pm

Hi,

I have a smart folder that should run when parameter condition is set to false. It wasn't evaluating correctly (the recorder module in the smart folder would not execute). I reset the rule to Not Equals = true and it ran properly. Is this how it should work? Seems strange that it executes like that.

Here's the value from the log:
Annotation 2019-09-05 092446.jpg
Annotation 2019-09-05 092446.jpg (64.14 KiB) Viewed 93 times
and the rule change to not equals:
Annotation 2019-09-05 092514.jpg
Annotation 2019-09-05 092514.jpg (41.52 KiB) Viewed 93 times
Are there issues or restrictions on how rules should be setup?

qa-auto
Posts: 32
Joined: Mon Aug 05, 2019 10:46 pm

Re: Rule ignored if parameter condition is equal = false

Post by qa-auto » Thu Sep 05, 2019 3:32 pm

I just flipped the logic around to evaluate to the result to true, and changed the rule to equal true and now it is not running. Bug?

qa-auto
Posts: 32
Joined: Mon Aug 05, 2019 10:46 pm

Re: Rule ignored if parameter condition is equal = false

Post by qa-auto » Thu Sep 05, 2019 3:35 pm

Is there a way to turn on logging to debug the rule other than the Log messages already being done before the rule is evaluated?

User avatar
qwertzu
Posts: 265
Joined: Wed Jan 25, 2017 11:08 am

Re: Rule ignored if parameter condition is equal = false

Post by qwertzu » Fri Sep 06, 2019 12:36 pm

Hi,

Can you send us a screenshot of the global parameter and the value?
I guess the global parameter "gVarlsClockedOut" is bound to the variable "varlsClockedOut", correct?

In the screenshot of the recording, I can see that the value of this variable is null.
That's why the smart folder only gets executed if the condition is set to "Is not equal true".

I'd recommend going through the user guide article about conditions: https://www.ranorex.com/help/latest/ran ... ons-rules/

There is also a very helpful blog post about this topic: https://www.ranorex.com/blog/how-to-cre ... ut-coding/


regards, qwertzu

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Rule ignored if parameter condition is equal = false

Post by odklizec » Fri Sep 06, 2019 12:57 pm

Hi,

All Ranorex parameters and variables are strings, so true/false is not in fact considered and evaluated as boolean keyword. If the parameter gVarlsClockedOut is empty, but condition is set to 'false', the condition is not fulfilled, hence it fails. If you want to check the equality of 'false' string, you must fill gVarlsClockedOut with 'false' string.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

qa-auto
Posts: 32
Joined: Mon Aug 05, 2019 10:46 pm

Re: Rule ignored if parameter condition is equal = false

Post by qa-auto » Fri Sep 06, 2019 2:47 pm

qwertzu wrote:
Fri Sep 06, 2019 12:36 pm
Hi,

Can you send us a screenshot of the global parameter and the value?
I guess the global parameter "gVarlsClockedOut" is bound to the variable "varlsClockedOut", correct?
>> Yes.

In the screenshot of the recording, I can see that the value of this variable is null.

>> It's only null at the start of the module; the user code sets the variable which is shown as False at the very end.

That's why the smart folder only gets executed if the condition is set to "Is not equal true".

>> I think it's because I'm returning a bool and not the string as Pavel mentions. I'll refactor it to see.

I'd recommend going through the user guide article about conditions: https://www.ranorex.com/help/latest/ran ... ons-rules/

>> Thanks, I have.

There is also a very helpful blog post about this topic: https://www.ranorex.com/blog/how-to-cre ... ut-coding/

>> Thanks, I saw that too.

regards, qwertzu
Last edited by qa-auto on Fri Sep 06, 2019 5:44 pm, edited 1 time in total.

qa-auto
Posts: 32
Joined: Mon Aug 05, 2019 10:46 pm

Re: Rule ignored if parameter condition is equal = false

Post by qa-auto » Fri Sep 06, 2019 5:43 pm

The issue was that the method was returning bool. All set now. Thanks for the help.

Lorinda