Micro Focus QTP (UFT) Forums

Full Version: Question how to calculate formula in the data sheet
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

the formula in the in the "A" cell is, for example: 9+3

The command
print DataTable("A", dtGlobalSheet)
gives me the literal entry, '9+3'

How can I get the value of the formula, thus 12?

Thanks in advance.
You have to put "=9+3" in the table cell just like Excel. The cell will display "12" unless the cell is being edited, in which case you will see the formula "=9+3". Summing values of other cells in the data table works the same way using Excel formulas. "=SUM(B1:B3)" will give you the sum of those three cells (B1, B2, and B3). Hope this helps.
Thanks for your answer.

But what I meant was just the eval function.

print eval(DataTable("A", dtGlobalSheet))

returns 12 ... Cool