Posted: 26 Feb 2018 22:35 EST Last activity: 6 Nov 2018 20:02 EST
Working with dynamic tables with universal web adaptor
Recently I was working in a project in which we had to use universal web adapter.The was a particular requirement the we had to update all the 1s in the "Preference status" column in to 2.We had to go through the rows and update one by one if they are 1.I was unable to do that because I was using the universal web adapter and I couldn't interrogate dynamic table contents using the bull eye.Is there any way to check how many rows of data in that dynamic table using the universal web adapter? When I just interrogated, 2 controls were created.One for the table header and the other for the body.Those controls were table rows. After updating 1 to 2, I had to tab in and create a new row in the bottom of the table. If I can count the No of rows, I will be able to send tabs and get in to the "Preference status" column of each row and update it until the cursor reaches the last row.Then I can send more tabs to create new row.
Is there any way to identify the row count of a dynamic table when using the universal web adapter? any solution is appreciated, even a simple C# code will save the lives.
Consider that the "branch/plant", "Preference status", "effective date" and expire date are all text fields
Did you try to clone the columns. It would help you to cope up with dynamic table content.
After you interrogate a column, create a new match rule with common attribute class and that should help you clone for the complete length of the column in dynamic table as a control. Set the use keys to true for the control.
Later in automation you would be able to use method like getClone and iterate through the results. It should help you in achieving your objective.
I was able to create the clones. I am just able to count the No of rows in the table.I am able to solve the problem.But, Is there a way that I can retrieve the inner text of a particular row(I was expecting any method like GetIndex or something like that)or am I missing something here?
According to the screen shot,I thought if I can use a Key here, I will be able to identify the row by using the same Key as the name parameter in the getItem method in the cloneCollectionProxy1. What is the value I am supposed to provide for "name parameter"? Its just passing Null as the output from the GetItem Method.
Just a few important points about cloning. Each control that is cloned will have its own key. In your example, when you wait for a control to be created and then reference it by key you are unlikely to get anything more than the first control created. You should always wait on the control outside of your cloned object. That should match after all of the child controls are matched.
The correct way to access cloned controls would be to send the GetClones method into a ListLoop. You can then iterate through each clone for processing. GetItem would not work in your situation. Collections are not guaranteed to be returned in a specific order, so you would need a way to determine which clone is which based on content.
Have you tried using the Html Table Designer? It should allow you to interrogate the whole table and then use an index to iterate through the table sections (rows).
As far as pagination, you can only match what is currently visible and you will need to provide the logic to move from page to page. If you wish to read the whole table, you can store the value in a lookup table as you page through the table. If you need to operate on a row in the table, you would need to return to the page where the row was located.