Repository path

Ask general questions here.
bibi
Posts: 2
Joined: Thu Jan 27, 2011 10:42 am

Repository path

Post by bibi » Thu Jan 27, 2011 10:53 am

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Repository path

Post by Support Team » Thu Jan 27, 2011 12:45 pm

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
.
Image

bibi
Posts: 2
Joined: Thu Jan 27, 2011 10:42 am

Re: Repository path

Post by bibi » Thu Jan 27, 2011 3:22 pm

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.