IF Condition

Ask general questions here.
Thet Thet
Posts: 21
Joined: Fri Jan 11, 2019 7:02 am

IF Condition

Post by Thet Thet » Fri Mar 08, 2019 8:30 am

Hi,

I want to write a condition from user code. If the "-" is exist in the data value, there is no need to execute current MasterCard Folder. If the "-" is not exist in the data value, execute MasterCard folder. Example, the data value is N21101 , N21101-1.
Can I write from user code.?
Thanks you.
Attachments
condition_blog.png
condition_blog.png (14.45 KiB) Viewed 210 times

manish
Posts: 45
Joined: Fri Aug 10, 2018 12:46 pm

Re: IF Condition

Post by manish » Fri Mar 08, 2019 11:37 am

Hi,

If I understand your problem correclty, you want to check the data value from a data connector and if it contains '-', you want to skip the execution of Master data. You want to acheive it via code.

For this you can first, create a module variable and bind it to the correct row in the data connector and then check if the value contaions '-'. If yes, the exit the current module from executing.

Try this
Unbenannt.png
Unbenannt.png (15.41 KiB) Viewed 202 times
Ofcourse you can also use the conditional operator from the test suite but I guess there is only the option of test data either being equal or unequal to a particular value. I dont think it has a contains option for evaluating condition.

Hope it helps
Manish

User avatar
Stub
Posts: 264
Joined: Fri Jul 15, 2016 1:35 pm

Re: IF Condition

Post by Stub » Fri Mar 08, 2019 3:38 pm

I was thinking that a "Contains" condition, along with Equals and Not Equal would be quite useful. Might be worth pumping such a request into the Ranorex UserVoice.