Page 1 of 1

Fetch row/column count and iterate through each cell values

Posted: Mon May 15, 2017 2:48 pm
by niranjantest
hi,

I am trying to access a grid build on Infragistics2.Win.UltraWinGrid control type. My intention is to get the below action donw :

1- get the row count
2- get the column count
3- iterate each cell value one by one

Attached is the app snapshot and spy shot.

Ranorex version-5.4.5

Any help will really get appreciate.

regards,
nir

Re: Fetch row/column count and iterate through each cell values

Posted: Mon May 15, 2017 3:02 pm
by odklizec
Hi,

What you have posted is screenshot, not snapshot. Ranorex snapshot is an xml file, containing the GUI structure. Unfortunately, screenshot is useless here. Please learn how to create a snapshot from the link in my signature. Thanks.

Re: Fetch row/column count and iterate through each cell values

Posted: Tue May 16, 2017 6:23 am
by niranjantest
Believe it or not I have tried to take the ranorex snapshot but Ranorex iteslf gets stuck and not able to save the same.

Let me try to take it today again..if success will able to share..

regards,
Nir

Re: Fetch row/column count and iterate through each cell values

Posted: Fri May 19, 2017 12:37 pm
by niranjantest
Unfortunately i cannot post the screenshot view due to company policy with the attachment restriction. I am able to fetch the row count successfully using the below code snippet but wondering how can i get the cells values of each rows.

var allegesTableRows = repo.FormWindow.AllegesTableRows;
int rowcnt=allegesTableRows.Rows.Count;

Any help will greatly be appreciable.

Thanks,
Nir

Re: Fetch row/column count and iterate through each cell values

Posted: Mon May 22, 2017 10:04 am
by asdf
Hi Nir,

I would try to get the values with the following code snippet.

Code: Select all

string accName = repo.FormWindow.AllegesTableRows.Element.GetAttributeValueText("AccessibleName");
string accValue = repo.FormWindow.AllegesTableRows.Element.GetAttributeValueText("AccessibleValue");
I hope this helps.

Best regards,
asdf

Re: Fetch row/column count and iterate through each cell values

Posted: Wed May 24, 2017 2:06 pm
by niranjantest
Thanks for the reply,

I tried the provided solution but again its returning NULL value in both cases. Also, i am bit wondering how without cell/row iteration it will fetch the value as suggested by you.

But i tried some other way as per below code snippets:

var allegesTableRows = repo.FormWindow.AllegesTableRows;
//var allegesTableCols = repo.FormWindow.AllegesTableCols;

int rowcnt=allegesTableRows.Rows.Count;

int cellCount=allegesTableRows.Rows[0].Cells.Count;

for (int i = 0; i<=rowcnt; i++)
{
for (int j = 0; j<=cellCount; j++)
{
String strvalue = allegesTableRows.Rows.Cells[j].Text.ToString();
Console.WriteLine("Value:="+strvalue);
}
}


But, now issue here is that console is printing the each cell values in a very slow manner. Its took around min 3-5(max) sec for each cell value to get fetched and displayed. Not sure why this performance issue or what is the root cause for this delay to fetch cells value from the grid.

Regards,
Nir

Regards,
Nir

Re: Fetch row/column count and iterate through each cell values

Posted: Wed May 24, 2017 2:47 pm
by niranjantest
Atlast after much R&D i could able to found a solution which works great way without any delay issue for the previously USED FOR loop. Below is the code snippet:

foreach(Row row in repo.FormWindow.AllegesTableRows.Rows )
{
//row.Focus();

foreach (Cell cell in row.Cells)
{
//cell.Focus();
String ColValue=cell.Element.GetAttributeValueText("AccessibleName").Trim();
String CellValue=cell.Element.GetAttributeValueText("AccessibleValue").Trim();
Console.WriteLine("ColName:="+ColValue);
Console.WriteLine("CellValue:="+CellValue);
}

}

Hope this solution helps other for their infragistric grid to get automated using Ranorex7

regards,
Nir

Re: Fetch row/column count and iterate through each cell values

Posted: Wed May 24, 2017 2:49 pm
by niranjantest
Thanks to asfd buddy for helping to give me the idea to resolve this issue. Thank you very much!!