Database Forum / FileMaker Topics / July 2008
Per Window Fields
|
|
Thread rating:  |
d-42 - 26 Jul 2008 19:18 GMT Alrighty... so I've run into an apparent limitation of filemaker that I can't seem to work around.
I'm doing a very simple report, find records between date x-y for customer z, I've done it a thousand times. One of the requirements is that the date range used for the report be displayed in the header.
No problem. Drop it into a global when generating the report, and display it on the final report.
The new requirement that's driving me insane: multiple windows. They want to be able to the run the report, and have it display in a new window, and run multiple reports, and have each in its own window 'side-by-side'.
No problem generating the reports in multiple windows, fm has been able to do this since version 7. But -how- do I show the date range used to generate the report? If I change the global, it will affect all the windows.
The one thought I've had is to define a calculated field as get(WindowName) and use that as a key to a relationship to a 'report header table' to store this header data for each window. But that's a lot of work, and I'm not even sure it would work.
Get window name is defined as "the name of the current window of the file in which the calculation is defined", which suggests that changing from window to the next will still affect all windows, because the calculation only ever has one value at a time. So if it 'works' I'm relying on the idiosyncracies of filemaker's window recomputing/repainting... which is a categorically bad idea.
Thoughts?
-Dave "Now and then we had a hope that if we lived and were good, God would permit us to be pirates." - Twain
Lynn Allen - 26 Jul 2008 19:53 GMT > The new requirement that's driving me insane: multiple windows. They > want to be able to the run the report, and have it display in a new [quoted text clipped - 5 lines] > used to generate the report? If I change the global, it will affect > all the windows. The header always displays information from the FIRST record in the found set. If, on performing the report, you set the start & End dates into fields in the first record, you can display that in the header. Don't use those fields for anything else, and you won't run into any other problems.
 Signature Lynn Allen -- www.semiotics.com Member Filemaker Business Alliance Long Beach, CA
d-42 - 27 Jul 2008 02:03 GMT > > The new requirement that's driving me insane: multiple windows. They > > want to be able to the run the report, and have it display in a new [quoted text clipped - 16 lines] > Member Filemaker Business Alliance > Long Beach, CA Thanks. I'd hadn't thought of that approach. Hmmm....
That would still break on the corner case of two reports happening to start on the same record. Which easily imaginable (e.g. generating a YTD report, and Monthly report, or two different product reports that start on the same day on a product that falls into multiple categories.)
Plus I really don't like the aesthetics/in-elegance of adding stored fields (ie to every record) of the table just to be able to show the date range. (although if it was the only way and it worked 100% I'd get over it.)
Plus by virtue of the records not being global, there are additional considerations to make it multi-user safe. (as 'header' record collisions can occur between different users, not just mutiple reports from a single user).
Thanks for your insight Lynn. It looks like there really is no clean way of doing this. Maybe I'll suggest to FM that we need another option for globals that are 'per window' not just 'per user' and keep my fingers crossed for FM10.
The more I use the new multi-window features of FM7+ the more unwieldy and incomplete I find them, even in FM9. :(
-cheers, Dave
Lynn Allen - 27 Jul 2008 03:40 GMT > That would still break on the corner case of two reports happening to > start on the same record. Which easily imaginable (e.g. generating a > YTD report, and Monthly report, or two different product reports that > start on the same day on a product that falls into multiple > categories.) Yes, sorry, I guess from your description, I assumed users would want non-conflicting reports. Darn users!
> Plus I really don't like the aesthetics/in-elegance of adding stored > fields (ie to every record) of the table just to be able to show the > date range. (although if it was the only way and it worked 100% I'd > get over it.) Empty fields (as most records would be empty) add very little overhead. It's not any kind of performance hit in the list of possible hits.
> Thanks for your insight Lynn. It looks like there really is no clean > way of doing this. Maybe I'll suggest to FM that we need another [quoted text clipped - 3 lines] > The more I use the new multi-window features of FM7+ the more unwieldy > and incomplete I find them, even in FM9. :( I agree. The windowing has never been elegant or easy, and after a brief fling with multiple windows, I've retreated back to one main window with the occasional single-purpose popup that gets dismissed after the user has accomplished a specific task. I got tired of the need to track windows by name, try to recognize the last open window (oops, you've closed your entire solution by mistake, you say?), etc.
Question. Could you possibly, for those who have a strange need to view multiple reports at the same time, generate PDFs of same and display those? You could embed the PDFs in container fields (in a related table?) for future reference, so the user could return to his single record with 6 associated reports anytime, and see the snapshot as it was when the report was generated. Refreshing any of those PDFs with current data should be trivial.
Or, when creating a report, export the found set into a separate "reporting" table with the relevant data. Or just the key of each record. The record can repeat over and over in different reports, and since one can read from or import from a found set without interfering with other users, this method is multi-user friendly. So is the PDF one. Then create a separate window for each report in the reporting table, you won't be displaying the "base" record, and so you can have a record participate in multiple reports. You could tag each created record with a user-id to keep them separated as well.
Trying to think beside the box.
 Signature Lynn Allen -- www.semiotics.com Member Filemaker Business Alliance Long Beach, CA
d-42 - 29 Jul 2008 00:11 GMT > Question. Could you possibly, for those who have a strange need to view > multiple reports at the same time, generate PDFs of same and display [quoted text clipped - 15 lines] > > Trying to think beside the box. Unfortunately, the current "reports" are somewhat interactive -- the ability to change the sort on the fly, stuff like that.
But yeah, I think that's the direction to take... if they want multiple onscreen at once they'll have to push the extra ones out to PDF and then they can have as many windows open as they want... or maybe push it to excel and they can still play with filters and sorts.
thanks again, Dave
Grip - 27 Jul 2008 04:34 GMT > I'm doing a very simple report, find records between date x-y for > customer z, I've done it a thousand times. One of the requirements is [quoted text clipped - 16 lines] > > -Dave In the script that generates your reports and windows, include your date range in you window name, rather than with a global on your layout.
If you need the date range to display, parse the window name into an unstored calc.
G
Grip - 27 Jul 2008 04:42 GMT > > I'm doing a very simple report, find records between date x-y for > > customer z, I've done it a thousand times. One of the requirements is [quoted text clipped - 25 lines] > > G I just came up with a cool little trick!
If you don't want the date range to show up in the title window, set the window to Title & ¶ & Date Range then make your unstored calc = GetValue(Get(WindowName); 2).
The window title will only show the first value.
G
d-42 - 29 Jul 2008 00:07 GMT > > > I'm doing a very simple report, find records between date x-y for > > > customer z, I've done it a thousand times. One of the requirements is [quoted text clipped - 35 lines] > > G Thanks Grip; that is a pretty neat and clever hack. (meant as a compliment)
I don't know that I'd want to actually use it... its the sort of thing that breaks when the next version of filemaker or widnows or osx comes out. Its clearly outside the intended use, and I prefer to avoid tricks like that in production software.
Plus there is likely a fairly low limit to how much data can be hidden their before it either gets truncated or 'bad things' happen, and the limit is probably OS dependant. I'll have to try showing a few kb worth of text into it to see what happens. :)
Finally... per my original post...
>Get window name is defined as "the name of the current window of the >file in which the calculation is defined", which suggests that >changing from window to the next will still affect all windows, >because the calculation only ever has one value at a time. So if it >'works' I'm relying on the idiosyncracies of filemaker's window >recomputing/repainting... which is a categorically bad idea. So while I can safely store the date range in the title, retrieving it in an unstored calculation is actually a potentially serious problem.
Consider this scenario:
A user has 3 windows open on my file: report [ jan-1 jan-15 ] report [ jan-1 jan-17 ] MainSolution
and you put an unstored calc into the table, set to GetWindowName and put it on each layout in the file.
Now, suppose, the user clicks on the main solution window. Per the definition of "GetWindowTitle", the value of "Get(WindowName)" only has ONE value. The name of the current window in the file is "MainSolution", so the value of Get(WindowName) is "MainSoution", and the value of that unstored calc, should it be evaluated is going to be "MainSolution" in ALL THREE windows.
Clearly that's not going to work.
Now, it may be the case that we don't notice this. After all, if the value changes but filemaker doesn't update the non-current windows with the new value, then everything will 'appear' ok. But it would be a categorically bad idea to rely on this behavior... sooner or later a non-current window is going to need to be refreshed for some reason, and display "MainSolution" on the report page... or worse, parse the 'report range' from a different current report window onto the refreshed non-current report window... and then all faith in the system is gone... since the displayed report criteria for one report appears to apparently randomly perpetrate itself to other reports.
cheers, Dave
Grip - 29 Jul 2008 03:47 GMT > I don't know that I'd want to actually use it... its the sort of thing > that breaks when the next version of filemaker or widnows or osx comes [quoted text clipped - 34 lines] > the value of that unstored calc, should it be evaluated is going to be > "MainSolution" in ALL THREE windows.
> Clearly that's not going to work. > [quoted text clipped - 11 lines] > cheers, > Dave I'm not going to twist your arm into using something you're not comfortable with, but some of your objections are apparently untested.
I just tested this and in a multi-window solution (10.4.11 FM9.03A) an unstored calc set to Get(WindowName) displays the value of its window, whether that window is active or not. All windows show a different value. I tried using Freeze Window and Pause and selecting various combinations of window selection, but I couldn't make it fail. If you've got some way of doing so, I'd love to know what it is.
I then did another test and Filemaker stored many values into a Window Name. 1,000 values produced no problems. 10,000,000 did :?) But then I'd assume that any unstored calc resolving 10,000,000 values would produce the same beach ball of pathetic slowness. Effective limit is somewhere in between. But then I realized the major major malfunction of this idea and that is any window management using WindowNames() gets hosed.
Still I haven't seen any evidence that the first half of the idea would not work. And it's perfectly simple.
G
d-42 - 29 Jul 2008 21:46 GMT > I'm not going to twist your arm into using something you're not > comfortable with, but some of your objections are apparently untested. Absolutely. Guilty as charged.
But with all due respect, testing is unreliable because it relies on a 'feature' that is undocumented, and therefore the behavior is potentially volatile. It may work when you test it, but that's no assurance that you can rely on it in general.
This would need to be tested on both Windows and OSX, in multiple versions, and multiple versions of filemaker on each before it could really be deemed safe. (And even multiple settings of different versions... for example the window compositing engine of Vista's Aero is entirely different than the one used for Vista classic) And even then there is no guarantee it will work in the next release of any of the 3 products. -- who knows -- maybe the next version of FM Pro will be fully multi-threaded and support using an unstored variable as a clock.
> I just tested this and in a multi-window solution (10.4.11 FM9.03A) an > unstored calc set to Get(WindowName) displays the value of its window, > whether that window is active or not.
> All windows show a different > value. That's not really unexpected. Filemaker's recalculation of unstored calcs is complicated and undocumented, but we DO know that unstored calcs are not real-time updated on the fly when the underlying data changes (at least in current versions of FM). For example, its well known you can't have an unstored calc set to Get(currenttime) and use it as a clock. And if you put such a field on multiple layouts/windows it will appear to be frozen at whatever time that layout / window was last updated.
Right?
But by that same token, that doesn't mean I would advocate deliberately using an unstored gettime calc for the *purpose* of displaying when I last visited the window, because i can't rely on the OS not needing to refresh that window for its own reasons, and updating the time value in the process.
The same sort of logic applies here.
> I tried using Freeze Window and Pause and selecting various > combinations of window selection, but I couldn't make it fail.
> If you've got some way of doing so, I'd love to know what it is. The way to make it fail would be to force Filemaker to re-evaluate the non-selected window -- without selecting it. Any sort of active script or manual direct manipulation of the window clearly won't do it.
An example of the sort of technique to mess it up would be to drag the current window over top of the unselected window, and then move it off again. The just-hidden-and-now-revealed window would need to be re- displayed, but since it really and truly is -not- the selected window and never was through the transition, its hard to say what FM would do; according to the documentation it would evaluate to the value of the currently selected window (ie the one you are dragging, not the one that needs repainting.)
Of course, perversely, the above example won't likely actually work, because the OS caches the hidden window contents for performance reasons (precisely so it can display a revealed non-selected window without potentially having to swap the parent application back into memory just to ask it to redraw it), so when you move the top window away the OS doesn't may or may not ask filemaker to repaint the screen, with a preference on not.
So to make it -actually- screw up, we're talking about something involving revealing the non-selected window after the OS has released the cache... maybe after waking from sleep/hibernate... maybe after doing enough 'other stuff' in a low memory system.
There may also be things we can do that force filemaker to request a repaint of a non-selected window without selecting it. For example adding a record to a table will cause other windows on that table to automatically update the found count... that may or may not also trigger a recompute of unstored calcs in current or future of versions of filemaker.
Relying on the idiosyncracies of the timing of Filemaker's window refresh and recalculation is asking for trouble. Its relatively easy to force FM to recalculate and make things "current"... but it does have lots of situations where it or the OS will decide to refresh things... and relying on it "not to" is inherently risky.
> I then did another test and Filemaker stored many values into a Window > Name. 1,000 values produced no problems. 10,000,000 did :?) But > then I'd assume that any unstored calc resolving 10,000,000 values > would produce the same beach ball of pathetic slowness. Effective > limit is somewhere in between. I wouldn't be surprised if FM maintains a internal buffer between the actual OS window name, and what FM uses.
e.g. I wonder if you were to use one of those utilties that lets you rename the window(s) of a running program whether FM would even see the new name or not?
> But then I realized the major major > malfunction of this idea and that is any window management using > WindowNames() gets hosed. That would be one issue. If it pushes the carriage returns out to the actual window instead of or inaddition ot maintaining a buffer, it may also mess with "task manager" programs, and other programs that query the window names.
> Still I haven't seen any evidence that the first half of the idea > would not work. And it's perfectly simple. It suffers from one of the same issues as the latter. The value of the unstored calc get(windowname) is defined as being the value of the *currently selected* window. So if a non-selected window is somehow refreshed/repainted without being made current, strange things could happen.
best regards, Dave
|
|
|