Returning string array values

Best practices, code snippets for common functionality, examples, and guidelines.
theraviz
Posts: 111
Joined: Sun Apr 14, 2019 9:46 am

Returning string array values

Post by theraviz » Sun May 17, 2020 2:03 pm

Hi,

I have a user code which returns multiple string values as a string array. Now I need to retrieve this values in a recording action.

With one returning variable, it is easy to go to the properties and assign it to a binding variable. How to solve this case when it returns multiple values?

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

Re: Returning string array values

Post by odklizec » Mon May 18, 2020 8:21 am

Hi,

I'm afraid, there is no way to automatically parse array of strings and bind them to module variables. In your user code, which I suppose is located in your recording in question, you will have to split the array into individual values and then assign each value to each recording variable of your choice. For splitting string, you can Split method. Check for example this page with sample:
https://docs.microsoft.com/en-us/dotnet ... sing-split
Last edited by odklizec on Mon May 18, 2020 8:26 am, edited 1 time in total.
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

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

Re: Returning string array values

Post by Stub » Mon May 18, 2020 8:22 am

Indexing parameter to request the nth item?
Comma-separated return value that another code module can then parse into separate values?

It depends what you're doing and how you're doing it.