Page 1 of 1

Repository path

Posted: Thu Jan 27, 2011 10:53 am
by bibi
Hello.
I'm new to ranorex and I have a question.
I have this path in repository and it works ok:

Form']/container[@controlname='viewContainer']/container/.//listitem[@index='1']", 10000, null);

But what I would like to do is to be able to change "index number"
So basicly I would like to do that:

Form']/container[@controlname='viewContainer']/container/.//listitem[@index=" + Settings.IndexRow + "']", 10000, null); <-- if I do that and build it it work exactly how i want it to work.

But if I do that in repository code it gets deleted because ranorex makes new code.
And if I try to enter this in repository(.rxrep) path I get this wirten in the code and ofc it doesn't work:

Form']/container[@controlname='viewContainer']/container/.//listitem[@index='\" + Settings.IndexRow + \"']", 10000, null);

If anyone knows the solution for my problem please post it:
Thank you very much.

Re: Repository path

Posted: Thu Jan 27, 2011 12:45 pm
by Support Team
Hi,

A possible solution would be to set the RxPath of the RepoItemInfo during runtime to a new RxPath:
YourRepository repo = YourRepository.Instance;  
//Get the RxPath of the element  
string RxPath = repo.Application.FooInfo.Path.ToString();  
//Repleace specific string of the RxPath and set the new  
//RxPath to the element  
repo.Application.FooInfo.Path = 
        RxPath.Replace("[@index='1']","@index='" + Settings.IndexRow + "'");
have a look at following link for further details:
http://www.ranorex.com/forum/repository ... html#p5820

Regards,
Tobias
Support Team

Re: Repository path

Posted: Thu Jan 27, 2011 3:22 pm
by bibi
Thank you very much for your help. I solved my problem with your help.

Just a little hint for anyone that will be using this information :
string RxPath = repo.Application.FooInfo.Path.ToString();

I had to read it a few times to notice this:)

Thanks again for your quick answer that solved my problem.