Fetch data from 2 rows in Table

Best practices, code snippets for common functionality, examples, and guidelines.
theraviz
Posts: 72
Joined: Sun Apr 14, 2019 9:46 am

Fetch data from 2 rows in Table

Post by theraviz » Mon Apr 20, 2020 11:47 am

HI,

How to get 2 row values from a table and store it in 2 variables or array in the same execution?

Eg : In the attached image, I want to retrieve the Amount of Order list where Count is > 50000

When I execute my Xpath I can get the result as 380000 in one variable. But I want 480000 also in the same execution. How to achieve this?
Attachments
Capture.JPG
Capture.JPG (19.64 KiB) Viewed 158 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6181
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Fetch data from 2 rows in Table

Post by odklizec » Mon Apr 20, 2020 12:00 pm

Hi,

If the xpath you are using returns more than one element, then you need to enumerate all returned items via for...each loop. Check for example this post:
https://www.ranorex.com/forum/unable-to ... tml#p58031
Basically, you need to pass the repo item to the method of your choice, which enumerates all items and eventually returns value of each item. Of course, you need to adapt the iList with appropriate element capability. If the table in question is web-based table, then you should use Ranorex.TDTag.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

theraviz
Posts: 72
Joined: Sun Apr 14, 2019 9:46 am

Re: Fetch data from 2 rows in Table

Post by theraviz » Wed Apr 22, 2020 10:46 am

Thanks. It worked :)