Try the scripts in this post (for Vision, not Perspective):
Probably want to save the results of your location decisions in a client tag to make it available to all windows in your project.
Go study all of the posts I linked, and maybe the links within those posts. This is not a problem specific to you, or to Ignition. There are a number of solutions that don't use the bit reset pattern (though PLC code is required for all solutions) in those linked posts. Pick one.