Filter multiple dataitem using REPORT.RUN or RUNMODAL

Alex_Chow
Alex_Chow Member Posts: 5,063
I know I asked this question, but for the life of me cannot seem to find it anymore on this forum... :(

Is there a way to default filters on 2 different dataitems on a report when using REPORT.RUN or REPORT.RUNMODAL?

Comments

  • Waldo
    Waldo Member Posts: 3,412
    OnPreDataItem you should be able to add/specify filters on that dataitem...

    If you want to pass filters "dynamically", I think you should be using a buffer table with SessionID.

    I do not remember your post either :|

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • remco_rausch
    remco_rausch Member Posts: 68
    Hi,

    This example works for a report that I did, the report consists of 4 dataitems that are the same but I think the principle should still work for your problem.

    CarryOutAuthorisationAction.SETTABLEVIEW(Rec);
    CarryOutAuthorisationAction.SETTABLEVIEW(Rec);
    CarryOutAuthorisationAction.SETTABLEVIEW(Rec);
    CarryOutAuthorisationAction.SETTABLEVIEW(Rec);
    CarryOutAuthorisationAction.RUNMODAL;

    Each time you make the settableview call it applies it to the next dataitem in the report.

    It works for me but i've never used it on a report with different dataitems.

    Regards,

    Remco
  • kriki
    kriki Member, Moderator Posts: 9,133
    Waldo wrote:
    OnPreDataItem you should be able to add/specify filters on that dataitem...

    If you want to pass filters "dynamically", I think you should be using a buffer table with SessionID.
    Better send the parameters from object to object through a singleinstance codeunit.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Waldo
    Waldo Member Posts: 3,412
    kriki wrote:
    Waldo wrote:
    OnPreDataItem you should be able to add/specify filters on that dataitem...

    If you want to pass filters "dynamically", I think you should be using a buffer table with SessionID.
    Better send the parameters from object to object through a singleinstance codeunit.

    Hm, didn't think of that, but indeed, that's a better idea ... no waste of tables :wink:

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • kriki
    kriki Member, Moderator Posts: 9,133
    Waldo wrote:
    kriki wrote:
    Waldo wrote:
    OnPreDataItem you should be able to add/specify filters on that dataitem...

    If you want to pass filters "dynamically", I think you should be using a buffer table with SessionID.
    Better send the parameters from object to object through a singleinstance codeunit.

    Hm, didn't think of that, but indeed, that's a better idea ... no waste of tables :wink:
    Nor losing performance because you write to the DB....
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!