Date filter in a report - can I set it through calcdate?

JosetxoJosetxo Member Posts: 92
Hello all,

It would be great if I could set the ReqFilterFields of a report in an unattended way.
I'd like to set the "Posting Date" Required Filter Field with a data range that would hold the CALCDATE('-8D', TODAY)..CALCDATE('-1D', TODAY).
Unfortunately, it seems not to work this way.

Can I set the date filter in such a way that it takes from a 8 days before to yesterday?

Many thanks in advance,
Josetxo

Answers

  • krikikriki Member, Moderator Posts: 9,110
    You have to do that before running the report:
    recSomeRecordWithPostingDate.RESET;
    recSomeRecordWithPostingDate.SETRANGE("Posting Date",CALCDATE('<-8D>', TODAY),CALCDATE('<-1D>', TODAY));
    
    and then run the report:
    repReport.SETTABLEVIEW(recSomeRecordWithPostingDate);
    repReport.RUNMODAL;
    

    PS: use < and > in a dateformula to make it language independant. (in Italian I would need to use '-8G', and it doesn't work in ENU, but '<-8D>' always works)
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • JosetxoJosetxo Member Posts: 92
    Thanks Kriki, solved this way. Great support from Mibuso once more ;)
  • billhwang2008billhwang2008 Member Posts: 32
    :?: Is this solution means I need to develop 2 Reports, one is input those codes, another one is called by the "repReport"?

    thanks.
  • krikikriki Member, Moderator Posts: 9,110
    It is not necessary to use another report. If you have a menuitem on a menubutton on a form, you can put the code in there (or even better: call a codeunit that puts the code) and then run the report.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • billhwang2008billhwang2008 Member Posts: 32
    Hi kriki, thanks a lot, I completed it as you told.
Sign In or Register to comment.