My recent experience with Peek function draws a huge parallel to that old friend whom you thought you knew, but turned out to be different. Enough of the melodrama
Peek function as we all by definition is "finds the value of a field in a table for a row that has already been loaded or that exists in internal memory." Keywords as I underlined are table that been loaded and exists in the memory; this has been my understanding until I was caught up in the scenario which involved multiple tables and variables.
I discovered that Peek works only for the last table loaded if multipl !e tables are loaded preceding the function. To illustrate the same, I have attached the App ("Peek Mystery"), where the variables vQuarterLlimit & vQuarterUlimit were not getting set correctly or rather getting set alternatively. After spending a good amount of time scratching my head, since overall code involved other variables and multiple peek functions (however using fields from the a single table), I could finally figure out that it was :
Peek would always set the variable for the table which was loaded second(in this example) or rather before the peek function
If the peek functions are called in right after the individual table loads ,it works fine
See the attached App for reference and share your expert opinion.
I will continue to spend some more time on this and update my findings!