Micro Focus QTP (UFT) Forums
Question how to calculate formula in the data sheet - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Question how to calculate formula in the data sheet (/Thread-Question-how-to-calculate-formula-in-the-data-sheet)



Question how to calculate formula in the data sheet - Arlequin - 10-01-2010

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.


RE: Question how to calculate formula in the data sheet - cdesserich - 10-01-2010

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.


RE: Question how to calculate formula in the data sheet - Arlequin - 10-02-2010

Thanks for your answer.

But what I meant was just the eval function.

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

returns 12 ... Cool