Hello,
There is RxPath expression (e.g. container[@platformclass=$name][$number]) that returns few elements. I need to get one of the results by its number.
It perfectly works in RxPath Editor and elements can be found.
But when I try to get element from code (before it, set values for $name and $number) it fails.
I suspect that the reason is that all repository variables are saved as string and in result RxPath become something like this:
container[@platformclass='class_name']['4']
instead of
container[@platformclass='class_name'][4]
Do you have any idea how to get one of the found elements by number?
Thanks,
Oksana
How to get one of few elements found for RxPath by number
Re: How to get one of few elements found for RxPath by number
In your usercode file, parse the number into an "int" type.
Code: Select all
int myNumber = int.Parse(stringNumber);
Shortcuts usually aren't...
Re: How to get one of few elements found for RxPath by number
Maybe, I've misunderstood something...
In repository I have:
variable:
number
element with RxPath:
MyElement:
container[$number]
In code in order to get some element by number:
int number = 2;
repo.number = number.ToString();//repo - is an instance of repository
//if ToString() is missed, error message appears
MyElement.Touch();//here I have to get specific element
So, how/where can I initialize repository variable with int not string value?
Thanks
In repository I have:
variable:
number
element with RxPath:
MyElement:
container[$number]
In code in order to get some element by number:
int number = 2;
repo.number = number.ToString();//repo - is an instance of repository
//if ToString() is missed, error message appears
MyElement.Touch();//here I have to get specific element
So, how/where can I initialize repository variable with int not string value?
Thanks
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: How to get one of few elements found for RxPath by number
Hello,
I am afraid but repository variables are created as string value not as int value.
You would need to parse your string to int and vice versa.
The 'ToString()' method is needed to convert your int value to a string value.
Regards,
Markus (T)
I am afraid but repository variables are created as string value not as int value.
You would need to parse your string to int and vice versa.
The 'ToString()' method is needed to convert your int value to a string value.
Regards,
Markus (T)