Hi,
I have a grid input control with up to 80 lines. I need to dynamically change the line I am accessing according to the amount of items that have been entered already, these item counts differ depending on runtime variables so they may end up on different Rows dependent upon runtime:
Row1_Input
Row2_input
...
Row80_Input
I have a variable counting the amount of items already entered , what I want is to enter Row_Input so the next item is automatically entered on the correct line. Ghost code would be something like:
for i in rows:
repo.grid.Row_Input.PressKeys("Item");
Am I thinking completely incorrectly here? Anyone tell me where I am going wrong please?
accessing a repository item using a counting variable
-
- Posts: 3
- Joined: Fri Dec 09, 2016 10:35 am
- RobinHood42
- Posts: 324
- Joined: Fri Jan 09, 2015 3:24 pm
Re: accessing a repository item using a counting variable
Hi,
it would be great if you could provide more information. A Ranorex snapshot file would allow us to better understand your application under test.
Snapshot file: https://www.ranorex.com/support/user-gu ... pshot.html
So, basically, you just want to get the first row, which doens't have any input value, correct?
Cheers,
Robin
it would be great if you could provide more information. A Ranorex snapshot file would allow us to better understand your application under test.
Snapshot file: https://www.ranorex.com/support/user-gu ... pshot.html
I have a variable counting the amount of items already entered , what I want is to enter Row_Input so the next item is automatically entered on the correct line. Ghost code would be something like:
So, basically, you just want to get the first row, which doens't have any input value, correct?
Cheers,
Robin

-
- Posts: 254
- Joined: Tue Mar 24, 2015 5:05 pm
- Location: Des Moines, Iowa, USA
Re: accessing a repository item using a counting variable
Something along these lines might work best. We could provide a more accurate sample if we had a snapshot so we knew what types we were dealing with.
foreach (var myRow in myRepo.Root.TableWithRow.FindDescendants<Ranorex.Row>()) { myRow.FindSingle<Ranorex.Unknown>("RxPath").PressKeys("Item"); }
Doug Vaughan
-
- Posts: 3
- Joined: Fri Dec 09, 2016 10:35 am
Re: accessing a repository item using a counting variable
Hi,
snapshot attached. And yes, basically I just want to write an item in the next row with no current value written.
I was looking at findsingle and assumed I would land there, but I was not able up to now to get it working.
Thanks
snapshot attached. And yes, basically I just want to write an item in the next row with no current value written.
I was looking at findsingle and assumed I would land there, but I was not able up to now to get it working.

Thanks
- Attachments
-
- sapgrid.rxsnp
- (189.52 KiB) Downloaded 25 times
- RobinHood42
- Posts: 324
- Joined: Fri Jan 09, 2015 3:24 pm
Re: accessing a repository item using a counting variable
Hi,
Thank you for uploading the snapshot file.
Maybe the following code snippet helps you.
Cheers,
Robin
Thank you for uploading the snapshot file.
Maybe the following code snippet helps you.
Table sapTable = "/form[@connectiondescription='QCA [SPACE]']//table[@name='SAPMV45ATCTRL_U_ERF_ANGEBOT']"; foreach (var row in sapTable.FindChildren<Row>()) { foreach (var cell in row.FindChildren<Cell>()) { if (String.IsNullOrEmpty(cell.Text)) { //Do anything cell.Click(); } } }The code finds all cells within your table, which do not have a text.
Cheers,
Robin

-
- Posts: 3
- Joined: Fri Dec 09, 2016 10:35 am
Re: accessing a repository item using a counting variable
works perfectly
Many thanks Robin. I was going the right way, but I am not sure I would have arrived

Many thanks Robin. I was going the right way, but I am not sure I would have arrived
