Announcements
Hello everyone,
I need to add an extra column in Chart of Accounts page with Net Change of the last year. The idea is to fill the Date filter and then in this extra column see the same amount of Net Change but for the last year.
Example.. If i select a period like 01012018..01042018 i want a second date filter to be filled with 01012017..01042017.
In order to do this I create two new columns called Net Change2 (flow filter like Net Change but with a where clause linked to Date Filter 2) and add a column called Date Filter (a flowfield Date) in G/L account table
Then i add this line in GetBalance function
GLAcc.SETFILTER("Date Filter",'%1..%2',v_StartDate,v_EndDate); GLAcc.SETFILTER("Date Filter2",'%1..%2',CALCDATE('<C-1Y>',v_StartDate));
My problem is how to automatically fill date filter 2 with the Date filter less 1 year? I don't want to be me to need to fill this, but be automatically filled after Date Filter 1. I tried the above code but no changes in Net change 2 when I modify the Date Filter like the image can show.
For now is the only thing i need to do to make this work
*This post is locked for comments
Thanks, it worked but I've added the recalculation of Net Change2 with calcfields..
So the solution was to create a text global var called LastDateFilter and add this code in the OnAfterGetCurrRecord of Page 16.
IF LastDateFilter <> Rec.GETFILTER("Date Filter") THEN BEGIN Rec.SETFILTER("Date Filter2",'%1..%2',CALCDATE('<-CY-1Y>', Rec.GETRANGEMIN("Date Filter")), CALCDATE('<CY-1Y>', Rec.GETRANGEMIN("Date Filter"))); LastDateFilter := Rec.GETFILTER("Date Filter"); CALCFIELDS("Saldo Periodo2"); END;
Do you mean the global variable? After the SETFILTER
OnAfterGetCurrRecord -
If LastDateFilter <> Rec.GETFILTER("Date Filter") THEN BEGIN
Rec.SETFILTER("Date Filter2",'%1..%2',CALCDATE('<-CY-1Y>', Rec.GETRANGEMIN("Date Filter")), CALCDATE('<CY-1Y>', Rec.GETRANGEMIN("Date Filter")));
LastDateFilter := Rec.GETFILTER("Date Filter");
END;
Where I assign the value to DateFilter?
No, it does not work.
You can try to put this workaround in page:
Create global variable to save "Date Filter"
OnAfterGetCurrRecord - If LastDateFilter <> Rec.GETFILTER("Date Filter") THEN BEGIN Rec.SETFILTER("Date Filter2",'%1..%2',CALCDATE('<-CY-1Y>', Rec.GETRANGEMIN("Date Filter")), CALCDATE('<CY-1Y>', Rec.GETRANGEMIN("Date Filter"))); LastDateFilter := Rec.GETFILTER("Date Filter"); END;
That's the problem I can't find the call of this function anywhere in the page or table.. maybe a code unit i don't know..
If you're saying to put this in date filter on validate() trigger
Rec.SETFILTER("Date Filter2",'%1..%2',CALCDATE('<-CY-1Y>', Rec.GETRANGEMIN("Date Filter")), CALCDATE('<CY-1Y>', Rec.GETRANGEMIN("Date Filter")));
It don't work either.. in page i fill the date filter but the column net change 2 don't change neither the column date filter2. The column date filter2 is empty in the page view, as the image of my last post
I'm sorry, I got confused, I thought there were two lists on the same page, I did not realize that was a setup by making the screenshot to show it
Where do you call GetBalance function?
I didn't understand your last reply sorry
I doidn't understand your last reply sorry
Are both lists pointing to the same rec?
What if you put the Date filter on first list?
The problem is the column net change 2 have always the same value... that code din't work because the date filter stay empty.. in the column date filter 2 i don't have any value.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156