Print different data on report while it running from different actions on page

hii,

i want to run my one report from two different action of page.

when running from first action it will be generate different data

and if same report i running from different action it would be generate different data.

how i can do this.

kindly give me the suggetion.

it’s urjent.

As you mentioned Do you want to run the same report from two different actions . so from first action for example it will show “Summary” of your report and from second action it will show “Details” of your report.

This is you want or something different. please clarify.

no…it’s not like that.from first action report’s date field should be the workdate and from second action report’s date field should be the null.

Hi,
You Cannot do it by assigning report in the action.
You need to create a function in report which set the date filter and then call that function from onPush Trigger of action.
Once you set the date you can call Report.Runmodal(ReC).

As Sourav suggested you need to use report.runmodal to run the different report
For Report. Runmodal check this link
msdn.microsoft.com/…/dd301122.aspx

Hi AmiJoshi,

As suggested what you need is to run the report with two different filter sets. That can be done very simple with the RUNMODAL function.

You didn’t mention which version of NAV you are using?

If you are using NAV 2016 (or was it already in 2015?), then you can do it a bit smarter. You start by defining two different parameter sets, which you then can edit later if you need to.

// Use the REPORT.RUNREQUESTPAGE function to run the request page to get report parameters
XmlParameters := REPORT.RUNREQUESTPAGE(206);
CurrentUser := USERID;
// Save the request page parameters to the database table
WITH ReportParameters DO BEGIN
    // Cleanup
    IF GET(206,CurrentUser) THEN
    DELETE;
    SETAUTOCALCFIELDS(Parameters);
    ReportId := 206;
    UserId := CurrentUser;
    Parameters.CREATEOUTSTREAM(OStream,TEXTENCODING::UTF8);
    MESSAGE(XmlParameters);
    OStream.WRITETEXT(XmlParameters);
    INSERT;
END;
CLEAR(ReportParameters);
XmlParameters := '';
// Read the request page parameters from the database table
WITH ReportParameters DO BEGIN
    SETAUTOCALCFIELDS(Parameters);
    GET(206,CurrentUser);
    Parameters.CREATEINSTREAM(IStream,TEXTENCODING::UTF8);
    IStream.READTEXT(XmlParameters);
END;
// Use the REPORT.SAVEAS function to save the report as a PDF file
Content.CREATE('TestFile.pdf');
Content.CREATEOUTSTREAM(OStream);
REPORT.SAVEAS(206,XmlParameters,REPORTFORMAT::Pdf,OStream);
Content.CLOSE;
// Use the REPORT.EXECUTE function to preview the report
REPORT.EXECUTE(206,XmlParameters);
// Use the REPORT.Print function to print the report
REPORT.PRINT(206,XmlParameters);

The example above is from the help text in NAV, but shows very good how you first create a table where you store the filter parameters. Then it shows how to use this filter set to both save as pdf, print and preview from the code.

Pretty smart right? [:)]

But of course you can also just do it - the old fashioned way!

Hi Ami Joshi and Soniya patel,
Please do not post same question multiple times.
dynamicsuser.net/…/to-run-the-report-from-two-different-actions-with-different-data-in-navision

Thanks Mohana. I have locked the other thread (referring it to this).

[mention:d37e849211a549bdb70a00b394567ad1:e9ed411860ed4f2ba0265705b8793d05] and [mention:beefc0313469484eb8fd25563fdf2239:e9ed411860ed4f2ba0265705b8793d05] - even if a question is urgent then you should not be posting it twice. If you have the same question as someone else, then just use the “I have this question too” function (just below Thread information). Then everybody else knows that this is an “important” question.