Page 1 of 1

User code created Repository item

Posted: Thu Jun 25, 2015 2:40 pm
by mghali
Hello Everyone,

I have a repository that has a dynamic value. I need to take the output from one of the steps that has the following code :

repo.ShellForm.Shell4.Code.PressKeys("Code"+System.DateTime.Now.ToString("MMddyyyy"));

O/P = CodeMMddyyyy,

This would create a new item in the list.

The next step I use should be selecting the repository item that would have a value "CodeMMddyyyy".

How can I code and create a repository Item that would be used for this step.

Thank you
Mona

Re: User code created Repository item

Posted: Thu Jun 25, 2015 3:42 pm
by krstcs
I would suggest a repository variable that you set right before you use the repo item.

If you post your XPath from the repo item you are using we can probably show you exactly what to change.

Re: User code created Repository item

Posted: Thu Jun 25, 2015 3:44 pm
by mghali
Thank you for the reply.

The xpath that I use is:

/form[@controltypename='ShellForm']//tabpage[@title='Reporting Configuration' and @controltypename='TabPage']/?/?/container[@controltypename='SplitContainer']/container[2]/element/container[1]/tabpagelist/tabpage[1]/?/?/table[@controltypename='ReadOnlyDataGridView']/row[@accessiblename='Row 50']/cell[@text> 'Code']

Re: User code created Repository item

Posted: Thu Jun 25, 2015 7:34 pm
by krstcs
I would add a variable like so, to the xpath in the repo:

Code: Select all

/form[@controltypename='ShellForm']//tabpage[@title='Reporting Configuration' and @controltypename='TabPage']/?/?/container[@controltypename='SplitContainer']/container[2]/element/container[1]/tabpagelist/tabpage[1]/?/?/table[@controltypename='ReadOnlyDataGridView']/row[@accessiblename='Row 50']/cell[@text=$codeValue]
This will add a repository variable that will automatically be added to any recording module that you use this repo object in. It will be called "codeValue" in the recording module. (Always preface variables with '$' in XPath.)

Then, in your usercode do this:

Code: Select all

codeValue = "Code"+System.DateTime.Now.ToString("MMddyyyy");

repo.ShellForm.Shell4.Code.PressKeys(codeValue);
Now you just need to add the mouse-click action to the repo element either in the usercode or in the action table after the call to this above code.

Re: User code created Repository item

Posted: Thu Jun 25, 2015 10:58 pm
by mghali
Thank you so much!!
That helped.

Re: User code created Repository item

Posted: Fri Jun 26, 2015 1:14 pm
by krstcs
You're quite welcome!