Execute Action depending on Data Excel Value

Ranorex Spy, Recorder, and Studio.
michael.w
Posts: 3
Joined: Mon Apr 11, 2016 10:27 am

Execute Action depending on Data Excel Value

Post by michael.w » Mon Apr 11, 2016 10:57 am

Hello together,

is there a possibility to let Ranorex decide if an Action should be executed depending on the value of the connected Test Data Excel Sheet? I want to execute an Action only if there is a value for it in the excel file if not Ranorex should skip it.

Best regards
Michael

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

Re: Execute Action depending on Data Excel Value

Post by odklizec » Mon Apr 11, 2016 11:51 am

Hi,

At the moment, the only way how to perform or skip an action based on a condition is to convert the action (or actions) to user code and create the condition in User Code.
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

michael.w
Posts: 3
Joined: Mon Apr 11, 2016 10:27 am

Re: Execute Action depending on Data Excel Value

Post by michael.w » Mon Apr 11, 2016 11:59 am

Hi,

that's the answer I expected...

can you show me some sample code how I can achieve this in user code?

Many thanks!

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

Re: Execute Action depending on Data Excel Value

Post by odklizec » Mon Apr 11, 2016 12:20 pm

Hi,

Basically, you need to create a new module variable (e.g. varName1) and then you need to connect that variable with proper data connector.

Then all you need to do is to enclose your converted recording action(s) in If...Then condition, like this:

Code: Select all

if (varName1 == "something")
	{
		your_converted_action_here;
	}
else if (varName1 == "somethingelse")
	{
		your_other_converted_action_here;
	}
Hope this helps?
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

michael.w
Posts: 3
Joined: Mon Apr 11, 2016 10:27 am

Re: Execute Action depending on Data Excel Value

Post by michael.w » Mon Apr 11, 2016 1:25 pm

Thank you odklizec!

It's working.

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

Re: Execute Action depending on Data Excel Value

Post by odklizec » Mon Apr 11, 2016 1:32 pm

you are welcome! ;)
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