Report SAVEASPDF set option /filter on request page

vissers9vissers9 Member Posts: 21
edited 2013-06-29 in NAV Three Tier
Hi all,

I have written code which does a SAVEASPDF on the aged account receivable report. So far so good, code works.
But what I see is that the "Aged of" date is not the currect or workdate, what I would like it to be.
It's an option defined on the requestpage.

I have tried and searched how to set this field. Probalbly it goes through a report variable.
Could you give me a hint how to access this field in code?

Thanks,

Rob

Answers

  • postsauravpostsaurav Member Posts: 708
    Hi Rob,

    I hope you are doing this activity via a separate report / Codeunit.

    How you can achieve what you is -

    1) Create a function in Aged account receivable say - setvalues with parameters that you want to set in your case a date variable.

    In this function assign EndingDate (source of Aged As of) to your date variable.
    Function SetValues(AgeDate : Date)
    EndingDate := AgeDate;
    

    2. call this function from report / codeunit from where you are trying to save it into PDF.
    AgedReport.SETTABLEVIEW(Cust);
    AgedReport.SetValues(TODAY);
    AgedReport.USEREQUESTFORM := FALSE;
    AgedReport.SAVEASPDFT('Filename',Record);
    

    I hope this resolve your issue.

    Let me know if any issues.

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • vissers9vissers9 Member Posts: 21
    Hi Saurav,

    Very nice to read your comment, read some of your other post as well, really usefull.
    Your comment guided me in the right direction.
    If I may comment on it, maybe for future reference for other users:

    I understand you cannot set the options in the request form of a report outside the report in code itself, have to do this via a function in the report. That really helped :-)
    This works.

    I did do some changes on the code below:
    AgedReport.SETTABLEVIEW(Cust);
    AgedReport.SetValues(TODAY);
    //AgedReport.USEREQUESTFORM := FALSE; //Taken this one out completely. It gave an error on compiling, and my feeling is that be default the SAVEASPDF does not use the request page, so that fixed it.
    AgedReport.SAVEASPDFT('Filename',Record); //Only 'FileName' left in the brackets. SAVEASPDF does not have the ability of passing a record, the filter is set by previous code.

    But as said, thanks for your suggestion. I'm just a financial controller with some programming experience, trying to make VAN work more for us.

    BR, Rob
  • postsauravpostsaurav Member Posts: 708
    Hi Rob,

    Thanks & you are always welcome.

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • SRishiSRishi Member Posts: 26
    Hi you can pass the filter Creating Function.

    In below code GetDate function is passing the date value to 50263 Report.
    Inside report I am filtering the recording using the passed parameter.
    I hope it would be useful for other pepole.


    Report50263.SETTABLEVIEW(Vendor);
    Report50263.GetDate(Date);
    Report50263.SAVEASPDF(FileName);
Sign In or Register to comment.