How to extract data from TDBGrid?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
paul_20k
Newbie
Posts: 1
Joined: Sat Jun 19, 2010 5:14 pm

How to extract data from TDBGrid?

Post by paul_20k » Sat Jun 19, 2010 5:35 pm

Hi

I am evaluating Macro Scheduler V12 for testing an application developed in Delphi. My application has a TDBrid with lot of data.

Question: Is there any way to extract data from TDBGrid and save it in a variable?

Thanks

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Sat Jun 19, 2010 7:03 pm

Use the Tools -> "View System Windows" to see if you can "see" any of the data this way. If yes, there is a chance to get at the data directly. If not, then you will have to use other GUI means to get at the data.

The technique I have used is to position the cursor in the grid and using a combination of clicks, and/or using the space key get the data to highlight. Then send the keystrokes of ctrl-c to copy the text to the clipboard. Proceed in a loop, using tab keystrokes to go from column to column until you have copied the entire row. And then usually in a grid of this type a Tab keystroke entered from the last cell repositions to the first cell of the next row. So in this fashion you can grab as much data as you like, not fast, but it works, I have done it.

Another technique would be to try image recognition to "read" the data.

Yet another technique I have used, (but this one requires a great deal of knowledge about how the system under test operates) is, if the grid displays data from a database, then program Macro Scheduler to connect directly to the database and perform a SQL query to get this information directly. Using VBScript or the new DBConnect functionality, this is quite easy.

tacquire
Newbie
Posts: 6
Joined: Fri Oct 08, 2010 5:24 pm

Did you have any luck?

Post by tacquire » Mon Oct 18, 2010 9:05 pm

Just wondering if you had any luck getting line items from a delphi grid.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Oct 19, 2010 8:19 am

The text capture functions can extract text from a TDBGrid.

Also if the grid is not read only you can use the clipboard. Double click in a cell (or tab to it and hit f2) and you can then select all and copy the cell contents to the clipboard.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts