AnsweredAssumed Answered

Refresh Window Refreshes more than the active window

Question asked by philmodjunk on Apr 8, 2014
Latest reply on Jul 18, 2014 by TSGal

Summary

Refresh Window Refreshes more than the active window

Product

FileMaker Pro

Version

13.02

Operating system version

Windows 7

Description of the issue

If you use a script to open multiple windows on the same layout but with unique window names. An unstored calculation field with Get (WindowName) fails to correctly match to a related record with a matching value and Refresh Window [Flush Cached Join Results] refreshes all open windows to show the wrong related data in all but the last window opened.

Steps to reproduce the problem

See this link for a demo file: https://dl.dropboxusercontent.com/u/78737945/WindowManagementDemo.fmp12

The script uses data in global fields to perform a find and to display the results in a new floating document window. In order to display the criteria used for the find and to be able to open multiple report windows with different found sets and to show the search criteria specific to each report, the script first creates a new record in a WindowManagement table, stores the global field values to be used in the find in nonglobal fields in this table and then copies the value of a serial number field to a variable.

The script then opens a new window with the serial number stored in the variable used as the window name, selects the report layout and then performs the find in that window. An unstored calculation field computes Get ( WindowName ) to access the current name (serial number value) of the window. It is used in this relationship:

DataToBeSearched::cWindowName = WindowManagementTable::WindowID

and the criteria fields from the WindowManagmentTable were placed in the header of the report layout to show what criteria were used to produce the report.

At first attempt, I noted that this worked correctly to create the first new report window and show the criteria as long as my script committed the new WindowManagement record. But when I ran the script a second time, the next new report window failed to update and still showed the same criteria shown for the first report window. I then put in a Refresh Window [flush cached join results] step after the perform find.

Expected result

That each new window would use the unstored value of Get(WindowName) to access the stored search criteria in the WindowMangement Table.

Actual result

The Refresh Window [Flush Cached Join Results] step refreshed all the open windows that showed this report layout and they all then showed the criteria for the most recent find instead of the criteria specified for each window.

Configuration information

I tried all kinds of different combinations of commit records and refresh window. Only Refresh Window with the "flush" option actually produced a change in what data appeared on the layout.

This could be a bug in that the relationship fails to use the current value of cWindowName to match to the correct value, it could be a bug in that Refresh Window refreshes more than the active window or both.

Workaround

Add a loop at the end of the find script that uses Select Window and the WindowNames function to loop through all open report windows and use Refresh Window [Flush Cached Join Results] to update each window.

In the demo file, you have two buttons that perform nearly the same script. The upper button has the loop that refreshes all windows. The lower one has a single Refresh Window step after the Perform Find step.

If you want to see what I originally saw, take the script for the lower button and remove/disable the Refresh Window step in it.

Outcomes