Global Variables

Global Variables

I am fairly new to Zoho and have been following the instructions relating to global variables here: 

https://www.zoho.eu/creator/help/script/sample-application-global-variables.html

I have two questions:

I can get this to work populating a field in a 'results' form using a script on the 'result' form's onload event but what I would really like to do is to call the getGlobalValue() function in a formula field - is this possible, I cannot seem to get it to work.

The function works on strings, if I had a value that was a decimal how would I amend the function to return a decimal result?

Many thanks for any help / advice.