Compare row in DT

Best practices, code snippets for common functionality, examples, and guidelines.
yaro2o
Posts: 87
Joined: Mon Jan 29, 2018 11:19 am

Compare row in DT

Post by yaro2o » Fri Mar 01, 2019 10:36 am

Hi, I am looking for the easiest way to compare the added row to the table with sample data, in the table I have 20 columns. in the end, it would be useful to say that in the employee column there is a different value than the example.

For now i add datasource and there i add query to get sample row, and in code module for each column i add variable and compare content but i think there must be a simpler solution.

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

Re: Compare row in DT

Post by odklizec » Fri Mar 01, 2019 10:40 am

Hi,

Have you considered using reference snapshot?...
https://www.ranorex.com/help/latest/han ... einwebibri
I'm using this approach for all web tables and it works quite nice.
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

yaro2o
Posts: 87
Joined: Mon Jan 29, 2018 11:19 am

Re: Compare row in DT

Post by yaro2o » Fri Mar 01, 2019 10:49 am

i heave desktop app and ODBC conn

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

Re: Compare row in DT

Post by odklizec » Fri Mar 01, 2019 10:56 am

You can do the same also for desktop tables. Just check other table-related examples ;)
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

yaro2o
Posts: 87
Joined: Mon Jan 29, 2018 11:19 am

Re: Compare row in DT

Post by yaro2o » Fri Mar 01, 2019 11:13 am

what should an example csv file look like?

yaro2o
Posts: 87
Joined: Mon Jan 29, 2018 11:19 am

Re: Compare row in DT

Post by yaro2o » Fri Mar 01, 2019 11:32 am

and where to put this code to make sense, in the cs file, new class file ?

yaro2o
Posts: 87
Joined: Mon Jan 29, 2018 11:19 am

Re: Compare row in DT

Post by yaro2o » Fri Mar 01, 2019 11:33 am

Can you add example ranorex file ?

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

Re: Compare row in DT

Post by odklizec » Fri Mar 01, 2019 12:11 pm

Hi,

There is no csv file used for table validation. There is used Ranorex snapshot file, as a reference file. Please check this Advanced validation example (entire table):
https://www.ranorex.com/help/latest/han ... einwebibri
Sadly, if you are not skilled in coding, you may find hard to adapt the code for your needs. And without seeing the snapshot of your table, there is not much anyone here can do or suggest.
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

yaro2o
Posts: 87
Joined: Mon Jan 29, 2018 11:19 am

Re: Compare row in DT

Post by yaro2o » Mon Mar 04, 2019 9:05 am

Ok another question if you can compare two data sources ?

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

Re: Compare row in DT

Post by odklizec » Mon Mar 04, 2019 9:10 am

Hi,

I’m afraid, I don’t understand what do you mean? Please describe in more details, what exactly you want to do. Thanks.
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

yaro2o
Posts: 87
Joined: Mon Jan 29, 2018 11:19 am

Re: Compare row in DT

Post by yaro2o » Mon Mar 04, 2019 9:11 am

i can not use the code from the example because I do not see all data from the table on the screen (some data is hidden and you have to move the slider) so I cant create snapshot

yaro2o
Posts: 87
Joined: Mon Jan 29, 2018 11:19 am

Re: Compare row in DT

Post by yaro2o » Mon Mar 04, 2019 9:19 am

SmartFolder -> Datasource 1
|
|___ TC1 -> Datasource 2
|___ Compare 2 data source from smartfolder and tc

It is possible ?

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

Re: Compare row in DT

Post by odklizec » Mon Mar 04, 2019 9:52 am

yaro2o wrote:
Mon Mar 04, 2019 9:11 am
i can not use the code from the example because I do not see all data from the table on the screen (some data is hidden and you have to move the slider) so I cant create snapshot
Ranorex should be able to create snapshot of entire table, regardless it’s entirely visible or partially hidden. The only problem could be with table, with danamically loaded data, where table loads only “visible” data. Are you sure the data from “invisible” part of table are not stored in snapshot? The data may not be visible in screenshot, but they may be saved!
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

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

Re: Compare row in DT

Post by odklizec » Mon Mar 04, 2019 9:56 am

yaro2o wrote:
Mon Mar 04, 2019 9:19 am
SmartFolder -> Datasource 1
|
|___ TC1 -> Datasource 2
|___ Compare 2 data source from smartfolder and tc

It is possible ?
Sure, you should be able to obtain data from both data connectors in TC1. The question is, how exactly is structured your test and what is inside both data connectors. Sadly, without seeing your solution, test data and app under test (at very least Ranorex snapshot), there is not much else anyone here can do or suggest.
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

yaro2o
Posts: 87
Joined: Mon Jan 29, 2018 11:19 am

Re: Compare row in DT

Post by yaro2o » Mon Mar 04, 2019 10:24 am

Ok I add snap,
Attachments
test2.rxsnp
(1.99 MiB) Downloaded 8 times