I have a table as the source of a form. I am setting the range of a date flowfilter for this table. The dates are for the previous month from the system date. It works fine. After the form is run, it is closed. When the system date turns to the next month, i.e. April 1st, and the form is run on April 1st, the data returned is from the previous month as if it were run on March 31st (02/01/09..02/28/09). I output the filter string set on the flowfilter before I set it and it is blank. Afte I set it I output it again and my filter is there (03/01/09..03/31/09 when run on April 1st) yet the data is still from the month before. Here is the odd part. If I compile the form, it works correctly again. I can change my system date to re-create the problem, but it is only "cleared" by compiling the form, NOT compiling the table.
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
In the table I have a flowfield with this formula ("Sales Last Month Date Filter" is a flowfilter)
Sum("Detailed Cust. Ledg. Entry"."Amount (LCY)" WHERE (Posting Date=FIELD(Sales Last Month Date Filter),Document Type=FILTER(Invoice|Credit Memo)))
In OnInit I set "Sales Last Month Date Filter" (the get functions return the first and last day of the previous month from the system date) :
SETRANGE("Sales Last Month Date Filter", GetLastMonthDate_fu(0),GetLastMonthDate_fu(1));
If I run the form today I get the data from 03/01/09..03/31/09. This is what I want.
If I don't compile the form until May 1st, when I run it I will get the same data from 03/01/09..03/31/09. After running it and seeing data from March, I compile the form and run it again (still May 1st). It works again giving me data from 04/01/09..04/30/09.
At that point I can then change my system date to anything and I will still get data from 04/01/09..04/30/09. If I compile the form, I can change my system date to anything, and it will give me the previous months data correctly.
1) C/Side is creating the form
2) OnInit
3) C/Side will read saved values from .zup file
4) OnOpen
As you can see, the saved values will overwrite your settings each time after first run. You need to set the filter in OnOpen, not in OnInit... :whistle:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
If the zup file is user specific then why does my compiling allow another user on another workstation to get this result. In other words, he runs it and gets the issue. I compile it from another workstation logged in as myself (and with a different license). He then sees the corrected behavior.
BTW, thanks for your help.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.