Change data binding source/parameters in runtime

Ask general questions here.
hsarmah2021
Posts: 16
Joined: Tue Oct 27, 2020 1:43 pm

Change data binding source/parameters in runtime

Post by hsarmah2021 » Tue May 04, 2021 11:21 am

Hello everyone,
I have a situation: in the recording modules that I have there are multiple strings that need to be validated and also some repository items have variables which are bound to string parameters. They were all in English, but now it needs to support other languages too and therefore these strings now need to binding to translated string values. I am not sure the best way of doing this, can anyone with similar experience respond with how to implement this?

I initially thought of having multiple data source for multiple languages and then changing the data source based on a condition, but this will probably not work since the data bindings to the variables are lost and they can be only bind to one data source at a time. Is there way to generate data binding automatically for a data source in runtime, e.g. from a properties file which can be read from code?

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

Re: Change data binding source/parameters in runtime

Post by odklizec » Tue May 04, 2021 11:39 am

Hi,

To load a different (existing) data source in a runtime, you can use the technique described here:
viewtopic.php?f=4&t=11788&p=52803#p47344

Eventually, if you want to edit/create content of data connectors in a runtime, you can use techniques described here:
viewtopic.php?f=4&t=16041&p=60540#p60542
viewtopic.php?f=20&t=18667&p=65104#p65054

I'm afraid, I'm not aware of any way of on-fly re-binding of data connectors to variables. So if the above methods are not usable for you, your only possible hope is to have all data in the same data connector, where each language uses its own data range. So then you can have just one data connector and then specify different data range either via TestCase/SmartFolders data connector properties or via code, as shown here:
viewtopic.php?f=4&t=15083&p=57705#p57705
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