How to save the datatable with UFT API Testing
I can use input values from an excel file with the datable but I would like to save the excel file with new values in it and the OK, KO results.
Do I have to create an GUI Test in my API test to add VB code ?
I hope there is something easier.
AFAIK, UFT API test don't have such activities to support write values in datatable.
However, you could write C# code in event handler if you are familiar with C#.
I just tried this code in C#:
The test is OK but I can't see the new value in the datatable at the end of the test.
Would you know why ?
Actually, I tried this:
var msg = GetDataSource("Data-Set!Sheet1").GetValue(2,"Results");
So I can get a message box with the new value but nothing in the datatable.
If you have a datatable linked to the test, when it starts running, the datatable is copied to memory datatable as a runtime datasource. So what you read or write in the code here is only doing things to the runtime datatable, not the actual file you want to update.
If you want to change the file itself, you need to code to work with the Excel file insteady of the DataSource API working on the Sheet.
I hope this helps.