Change a Variable Within Module

Ranorex Spy, Recorder, and Studio.
airwolf12
Posts: 2
Joined: Fri Sep 07, 2018 3:54 am

Change a Variable Within Module

Post by airwolf12 » Fri Sep 07, 2018 4:12 am

I have a recording module that contains steps that act on a repository item that is defined with a variable. That variable is bound to a value and everything works when I act on that repository item. However, I would like to change the value of that variable and then act on that repository item again and this is what I am struggling with. I am doing this just using Studio without any user code, I am curious if there is a way to change variable values in the middle of a recording module.

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

Re: Change a Variable Within Module

Post by odklizec » Mon Sep 10, 2018 8:20 am

Hi,

What you want to achieve is not doable without using either different variable name (bound to another data connector column/parameter), or some user code inside the recording module in question.

A code-less way would be splitting the recording module to two (or more) modules and then placing the modules in a separate smart folders, where each one use different data connector rows or different parameter values. This way you can use the same variable name within each recording, but filling it with different content. The structure of code-less test, could look like this:

Code: Select all

[SmartFolder_1] <--- data connector 1 - data range set to row 1
|_Recording _A <--- your variable filled from row 1
[SmartFolder_2] <--- data connector 1 - data range set to row 2
|_Recording _B <--- your variable filled from row 2
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

airwolf12
Posts: 2
Joined: Fri Sep 07, 2018 3:54 am

Re: Change a Variable Within Module

Post by airwolf12 » Tue Sep 11, 2018 4:41 pm

Ok, thank you. I ended up restructuring my test a little bit and also used a Smart Folder to loop through the test multiple times with different data. It would be awesome if there was a code-less way to set variables on the fly, but for now I can make this work. Thanks again!