Connecting CSV file programatically

Ask general questions here.
Jenny
Posts: 18
Joined: Thu Apr 14, 2016 5:04 pm

Connecting CSV file programatically

Post by Jenny » Thu Apr 14, 2016 5:37 pm

Hi,

I was trying to connect CSV file by writing the connection string programmatically. I need to establish the connection to the CSV file and then need to read the file row by row and column by column.

Ranorex.Core.Data.CsvDataConnector csvConnector = new
Ranorex.Core.Data.CsvDataConnector("myCSVConnector", "C:\\Users\\Public\\Documents\\ Filename.csv",
true);
Ranorex.Core.Data.ColumnCollection col;
Ranorex.Core.Data.RowCollection row;
csvConnector.LoadData(out col, out row);

But I'm getting an error in the connection string, and the error is "The typename CsvDataConnector does not exist in the type Ranorex.Core.Data.CsvDataConnector"..Am I missing any assembly reference file here?
I have 1) using Ranorex, 2) using Ranorex.Core, 3) using Ranorex.Core.Testing reference files.

Please let me know what assembly reference I need to add here.

Thanks for any help,
Jenny

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

Re: Connecting CSV file programatically

Post by odklizec » Fri Apr 15, 2016 8:42 am

Hi Jenny,

The code looks OK to me.
What version of Ranorex are you using? Latest is 5.4.6.
Have you tried to reinstall Ranorex?
Could you please post a sample project?
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

Jenny
Posts: 18
Joined: Thu Apr 14, 2016 5:04 pm

Re: Connecting CSV file programatically

Post by Jenny » Mon Apr 18, 2016 9:31 pm

I made it work , It worked after I added 'Ranorex.Controls' in my class file

Thanks!

Jenny
Posts: 18
Joined: Thu Apr 14, 2016 5:04 pm

Re: Connecting CSV file programatically

Post by Jenny » Mon Apr 18, 2016 10:02 pm

Hi,

In my application , I have many lists and many checkboxes in a window called XYZ. The list1 named ABC contains 10 check boxes named 1,2,3,4---10.The list2 named PQR contains another 10 checkboxes named a,b,c,d,e,f..j. Then I have an attached CSV file that has the column ABC and PQR with values 1,2,3,4...10 and a,b,c,d,e...j. What I need to do is read CSV file row by row , column by column. It should take each cell data and then check the checkbox according to the cell values in the lists.For example read 1st celldata 1 under list ABC and then check the checkbox 1 under list ABC, celldata under list PQR and check the checkbox under list PQR in the application. Then read next row , and goes on until the end of CSV file.

Can you tell me how to read specific cell data from csv file and then check the checkbox accordingly..
Thanks for any help.

Regards,
Jenny

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

Re: Connecting CSV file programatically

Post by odklizec » Tue Apr 19, 2016 7:33 am

Hi Jenny,

Could you please post a Ranorex snapshot of the window in question? A CSV sample would be nice too.

You see, it's pretty hard to suggest something reliable just from the description of your problem. It would be much easier to suggest something with Ranorex snapshot (sample app would even better) ;)
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

Jenny
Posts: 18
Joined: Thu Apr 14, 2016 5:04 pm

Re: Connecting CSV file programatically

Post by Jenny » Wed Apr 20, 2016 4:21 am

Hi,
I have attached my sample CSV file and the sample window in my application. Let me know how to read the cell data and put the checkmark in the application according to the celldata.

Thanks,
Jenny
Attachments
App-Window.jpg
MyApplicationWindow
App-Window.jpg (48.67 KiB) Viewed 575 times
CSV_File.csv
MyCSVFile
(109 Bytes) Downloaded 34 times

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

Re: Connecting CSV file programatically

Post by odklizec » Wed Apr 20, 2016 7:03 am

Hi Jenny,

Thanks for the csv. Now please post also Ranorex snapshot (look here how to create one), not screenshot ;) Screenshot is unfortunately not very helpful.

BTW, if I understand you right, you want to 'check' each check box, based of the checkbox names stored in CSV?
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