Use variables in code

Best practices, code snippets for common functionality, examples, and guidelines.
User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 4047
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Use variables in code

Post by odklizec » Wed Nov 28, 2018 3:35 pm

It appears, that in code modules, you must explicitly create a new code module variable. This variable must be binded with data connector. And then in code you can fill the repo variable using the code module variable, using code like this:

Code: Select all

repo.Dokument = Dokument;
where 'Dokument' is a new code module variable, binded with data connector.

BTW, is there a reason why you are trying to do everything in code? I mean, there is no shame in using recordings. Your TA life will be much easier if you use recordings wherever possible and use code modules only if there is no other way to achieve what you want. Recordings not only minimizes the chance of user code errors, but working with repository is easier too ;)
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

yaro2o
Posts: 67
Joined: Mon Jan 29, 2018 11:19 am

Re: Use variables in code

Post by yaro2o » Thu Nov 29, 2018 9:26 am

Thx now works fine :)