Filter Posting Date in Page:Payment Journal

IvonaKIvonaK Member Posts: 115
edited 2013-12-07 in NAV Three Tier
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,

Comments

  • Wisa123Wisa123 Member Posts: 308
    Hi,

    Do you actually call the Function in the page
    and do you do a CurrPage.UPDATE after ?
    Austrian NAV/BC Dev
  • IvonaKIvonaK Member Posts: 115
    Hi,
    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_SchouTommy_Schou Member Posts: 117
    Try using CurrPage.Activate instead of update.
    Best regards
    Tommy
  • IvonaKIvonaK Member Posts: 115
    It does not work . When I try to save page 256 it show me error like this: You have specified an unknow variable Activate
  • IvonaKIvonaK Member Posts: 115
    Sorry , I confuse little .
    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,
  • Tommy_SchouTommy_Schou Member Posts: 117
    Ahh ok. You are not running the newest version 2013R2 then.

    Good that you got it to work.
    Best regards
    Tommy
  • IvonaKIvonaK Member Posts: 115
    I run Nav2009.

    Can someone tell me what is the difference between
    ParGenJunLine.FINDFIRST;

    and

    IF ParGenJunLine.FINDFIRST THEN;

    Thanks,
  • geordiegeordie Member Posts: 655
    The behavior in case of no records found: in the first case an error is raised, in the second one execution continues (with ParGenJunLine variable empty, indeed).
  • IvonaKIvonaK Member Posts: 115
    Thanks a lot.
Sign In or Register to comment.