Two questions about your code:
- I see you name some of your calculation variables with a leading tilde, e.g.
~rep
Any reason for this? - These lines intrigue me:
~rep = Code(Get(WindowName))
$$Activity[~rep] = ...
It looks like you are taking the name of the window, and converting that to an integer, and then using a repeating field $$Activity[] to store the data for that specific window.
Is this safe, however? If the Window name is long, then you'll end up with a ridiculously long integer:
My assumption would be that $$Activity[ a very long integer] would lead to out of memory errors as FileMaker attempts to allocate a gigantic array. Perhaps that's not what FileMaker does for repeating fields or variables?