How are you monitoring the value of this global variable? I would guess that you put <<$$R>> as layout text onto your layout in order to set up a merge variable.
If so, you need to refresh this layout object after changing the value of the variable.
In FileMaker 13, you can give this text object and object name and add Refresh Object as the last step of your script.
In older versions, you'd use Refresh Window.
Oh yes, and if all you want to do is display the current record number, this can be done without scripting and without using any variable. There is an option for adding a layout symbol for this available from your Insert Menu if you make this selection while in Layout Mode.
Thanks for replying PhilModJuk! I did forget about the refresh window part. Eventually I want to havesomething like this:
<<RecordNumber>> out of <<FoundCount>> (<<TotalRecordCount>> Total)
4 out of 35 (200 Total)
To achieve this, the current solution is using three unstored calculation fields for those three items, which in my opinion may not be a good way to implement something like this. I think I could use global variables to get the same result. You're right about the record number part. I could simply use "@@" to get the current record number. What about the other two values? Do I have to use scripts and triggers?
Check your Insert Menu. There should .FP7 compatible symbols for each. (FileMaker 12 introduces new symbols for these type layout objects that are more descriptive than @@)