Micro Focus QTP (UFT) Forums
Function to calculate GST - 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: Function to calculate GST (/Thread-Function-to-calculate-GST)



Function to calculate GST - Brian - 04-15-2008

Hey guys,

Ive written a very simple function to check whether the GST that is calculated on a website is correct or not. The website displays the total value (cost including GST) and also the GST price seperately. Im just taking these values and inputting them into the following function -

Code:
Function Check_GST (theTotal, theGST)

standardGST = Get_GST(theTotal) [i](another function that i'm calling)[/i]
actual = theTotal - theGST
If (actual = standardGST )Then
    msgbox "this is tue"
else
    msgbox "this is NOT true"
End If    

End Function


Im calling this function from my script as -
Check_GST (total, GST)

but im getting the following syntax error message -
"Cannot use parentheses when calling a Sub"

Does anyone know why im getting this error and how i can rectify it?
Thanks,
Brian


RE: Function to calculate GST - niranjan - 04-15-2008

use call statement...
Code:
standardGST = Call Get_GST(theTotal).

There are two ways one can call procedures
1) By using Call statement.
if you use call statement, then Call some_function_name(param)
2) Without Call statement
some_function_name param


RE: Function to calculate GST - Brian - 04-16-2008

Thanks,
works now!