I have change Page: 256 Payment Journal , I have added a new field gPostingDate (gPostingDate is Variables , DataType:Date)
I want to make filter depending on CurrentJnlBatchName and my new field gPostingDate.
For this purpose I create new function:FilterPostingDate in CU:230 GenJnlManagment.
There is the code for function FilterPostingDate:
FilterPostingDate(VAR ParGenJunLine : Record "Gen. Journal Line";ParPostingDate : Date;JurnalTemplateName:Code[10];JurnalBatchName:Code[10])
ParGenJunLine.RESET;
ParGenJunLine.SETRANGE(ParGenJunLine."Journal Template Name",JurnalTemplateName);
ParGenJunLine.SETRANGE(ParGenJunLine."Journal Batch Name",JurnalBatchName);
ParGenJunLine.SETRANGE(ParGenJunLine."Posting Date",ParPostingDate);
ParGenJunLine.FINDFIRST;
And I call this function in Page:256 Payment Journal on gPostingDate-OnValide() but does not work very well.
Please for advice.
Thanks,
0
Comments
Do you actually call the Function in the page
and do you do a CurrPage.UPDATE after ?
Yes I call the function from page:256 Payment Journal on gPostingDate-OnValide:
GenJnlManagement.FilterPostingDate(Rec,gDatePostingDate,General,Test);
CurrPage.UPDATE;
Now I put CurrPage.UPDATE, but stil does not work. I get a error like this:
"There is no Gen.Jurnal Line within the filter.Jurnal Template Name:General, Jurnal Batch Name: Test, Posting Date:21.10.2013"
But If I change the last line of code
ParGenJunLine.FINDFIRST
to be
IF ParGenJunLine.FINDFIRST
THEN
MESSAGE('ok')
ELSE
MESSAGE('not ok');
It works , but I get the message ('ok','not ok') depending if there is data or not in table 81 Gen.Jurnal Line.
Tommy
It works great with the last line ParGenJunLine.FINDFIRST
I call the function from page:256 on gPostingDate-OnValide like this:
GenJnlManagement.FilterPostingDate(Rec,gDatePostingDate);
CurrPage.UPDATE(FALSE);
and it work great.
Thank a lot,
Good that you got it to work.
Tommy
Can someone tell me what is the difference between
ParGenJunLine.FINDFIRST;
and
IF ParGenJunLine.FINDFIRST THEN;
Thanks,