Forum Discussion
'this is a slower option,but if you dont have too much data to scan through
'this also assume that the order number in the parent exists as a column in the child excel sheet, otherwise i m not sure how to 'identify what 'order' belongs to what parent
set parentDriver = DDT.ExcelDriver ("FullPathParentFileName","sheet",T/FAce) set childDriver = DDT.Exceldriver("FullPathChildFileName","sheet",T/FAce) parentDriver.First while not parentDriver.EOF ..'your code here orderItemNumer=parentDriver.Value("OrderNumberColumn") childDriver.First while not chidldriver.EOF if orderItemNumber = childDriver.Value("OrderNumberColumn") then ...'your code here end if childDriver.Next wend parentDriver.Next wend
The second would be to create an adodb object and query the excel file.
I dont recall the whole process so you might have to do some homework also the above is in vbscript.
the second would to deal with : http://www.w3schools.com/asp/ado_ref_connection.asp
.. open a connection to the excel file : https://www.connectionstrings.com/excel/
here's an code script from microsoft (again this is vbscript)
On Error Resume Next Const adOpenStatic = 3 Const adLockOptimistic = 3 Const adCmdText = &H0001 Set objConnection = CreateObject("ADODB.Connection") Set objRecordSet = CreateObject("ADODB.Recordset") objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Scripts\Test.xls;" & _ "Extended Properties=""Excel 8.0;HDR=Yes;"";" objRecordset.Open "Select * FROM [Sheet1$]", _ objConnection, adOpenStatic, adLockOptimistic, adCmdText Do Until objRecordset.EOF Wscript.Echo objRecordset.Fields.Item("Name"), _ objRecordset.Fields.Item("Number") objRecordset.MoveNext Loop
the site:https://technet.microsoft.com/en-us/library/ee692882.aspx
Hope this helps
EDIT:
forgot to mention,
if you are using a keyword test:
could you not create data driven loop and loop inside that loop?
DDL ->parent file
Set Variable Value ->assign the id to a variable
DDL-> child file
if.. then ->variables.variablename Equals Variable.def("d") <--this last one is the DDL from the child above.
..your code?
something like above?
- keithowens11 years agoNew Contributor
Thanks for the suggestions. I am trying to integrate teh final one with the nested datasource into my work however my screen is looking much different to yours. I have the xml mapped to the data source but cannot see where I would place the nested one.
My screen looks like this image.
Am I way off target with my thinking?
- finae11 years agoContributor
I think we're using different version of the application.
I m using TestComplete 9, and the GUI image of teh DDL is different than yours.
I do not see a Data Source Loop operation in my list of default operation, so my answer to your question might be mute.
The Data source i have available are: Excel, CSV, DataTable, Database Query, and Database Table.
I dont see XML as the source, though i think it would be possible.