Manuel_J
Member
Reged: 07/16/08
Posts: 45
|
|
I would like to know how to write / update to DataTable during runtime and saving Default.xls. Currently I way I can think of is exporting DataTable to a different file, but this is not ideal.
|
jbotash
Guru
Reged: 01/19/00
Posts: 2009
Loc: USA, CA
|
|
[Assuming, you did not attach external Excel as your DataTable source] If you write:
DataTable.Value(ParameterID [, SheetID])=NewValue
new value will go into Default.xls and will be saved automatically when TC finishes. Next time - it will appear in this Default.xls as you've set it. No additional import\export is required.
(This is from QTP Help --> DataTable Object, Value Property)
Janna
|
Manuel_J
Member
Reged: 07/16/08
Posts: 45
|
|
Thanks for the reply. I did use your example but my Default.xls does not take the new values. Instead when I view results I can see the update when I view runtime DataTable.
|
jbotash
Guru
Reged: 01/19/00
Posts: 2009
Loc: USA, CA
|
|
OK. Let's try to Export data into Default.xls [not into different file, because you do not need that as you've said...]
As you know: Export Function in QTP works as 'SaveAs' and requires absolute full path to Excel file. We do not need to hardcode path for our Default.xls. It should be universal, compatible with any TC. Right? OK. We can BuiltIn QTP's Environment variable ["TestDir"] to code this path.
Try:
Datatable.Export(Environment.value("TestDir") &"\Default.xls" )
Janna
|