Posting Date filter

Hello Experts,

I have been asked to create two fields ‘From Date’ and ‘To Date’ in General Ledger Setup table. Then in ‘General Ledger Entries’ page when I use filter for Posting Date (e.g. 12/10/2012…05/05/2016) then it will show all the records till today. Also, I need to use ( where From Date<= To Date) expression.

For that I need to write a code within OnOpenPage Trigger of ‘General Ledger Entries’ page. And I also declared two global variables ‘From Date’ & ‘To Date’ and a record variable RecGLSetup(General Ledger Setup). But I don’t know the exact code for this?? Can anyone please help me out??

Regards,

Hi,
What data is there in G/L Setup Table fields From Data & Two date.Why you are adding these two fields.

Basically I add those two fields so that on ‘General Ledger Entries’ page I can filter data on ‘Posting Date’ by using From Date and To Date.

Ok Thanks,
In my view you will not need two fields to add on GL Table.
Just declare two variables on page and it will work fine.
May I know which version you are using currently.

RecGLSetup.Setrange(‘Posting Date’,FromDate,Todate);
I think it should do your work fine.

Also write the code onAftergetrecord trigger.

It’s 2013 r2

ok. dont add fields on gl table and work on page trigger with setrange. you will get the result as required.

Sorry but it didn’t work. It shows a message ‘A field from a record variable was expected’
‘Record.Field’
‘Customer.Name’

Use Rectablename.field inside strange field function. Are you entering the two dates manually by user.

Did it before but doesn’t work.

Rajat,

Write something like this. Keep on trying and thinking whatever you write.

Glsetup.GET;
GLEntry.SETRNAGE(“Posting Date”,Glsetup.StartDate,Glsetup.EndDate);
GLEntry.FINDSET;

Hi i Think you are Trying To Achieve Matrix Page

Then Refer This Video

  1. you need to set filter on G/L Entry (Rec) and not GL Setup
  2. You need to get GLSetup first to apply values /filters on GL Entry rec.

Hi ,
Just Update the Current Page that would Fix Your Problem…
To Date - OnValidate()
SETFILTER(“Posting Date”,’%1…%2’,FromDate,ToDate);
CurrPage.UPDATE;