Forum Discussion
How are you opening the file as a database now in TestComplete? It seems a simple matter of some sort of if/then logic or case/switch statement. Depending upon the result of the logic, assign the filename string to a variable which you then use in whatever code you have for opening the excel file.
- jewe6 years agoOccasional Contributor
Dear robert,
Using the workspace --> temp var --> <var>
which is a DB table with default value {Worksheet: "Sheet1"; workbook: "CommandDatabase.xls"}
Best regards,
Jewest
- tristaanogre6 years agoEsteemed Contributor
OK, so you're using a Project or ProjectSuite variable for your excel data.
What you will probably need to do is replace that with script code. I'm assuming you're doing a read-only view of the data table. So, I would use the DDT.ExcelDriver method call to create an object to retrieve the data from the excel table.
In that method, you reference the name of the Excel file you want to use. Replace that with a variable. So, here's some pseudo-code. Understand this is REALLY pseudo code and does not necessarily match a known syntax or structure, just presented to give the general idea.var deviceName = CheckDevice() // <- some function or method to determine the device var excelFileName; case deviceName of 'device1' : excelFileName = 'device1.xlsx' 'device2' : excelFileName = 'device2.xlsx' else : excelFileName = 'default.xlsx' var databaseDriver = DDT.ExcelDriver('C:\\DataStore\\' + excelFileName, 'DATA', true)
- jewe6 years agoOccasional Contributor
I understand the idea, the only problem is that this object does not have the same interface as the DB Table.
Is there a property or a casting possible?
I could not find it in the TC documentation.
Related Content
- 3 years agoOfer-Yaniv
- 8 years agovikram_u_k
Recent Discussions
- 2 days agoGane195