Why is this:
Turning into this:
Basically, where did that $ come from?
the script to set the g_page_number field is fine, its the filemaker symbol for page number that is causing problem.
In Layout mode try selecting the text string and looking at the number formatting options in the Inspector; you may well find that numbers are set to Currency formatting. If you change this to As Entered you should be right.
Retrieving data ...