Options

Running a report from a form or the Object Designer

aztecconsultingaztecconsulting Member Posts: 55
Is it possible to tell if a report is being called from a form or from the object designer? I want to fire some functionality if the user is running the report from a button on the form, but not if I am running it from the designer. I'm hoping to make the change to the report because this isn't a form we can easily modify so I am looking for a way to determine it in the report.

Comments

  • Options
    kinekine Member Posts: 12,562
    If you do not want to modify the form, I think, it is not possible, only if the report is called from the form without request form. Than you can use the variable CurrReport.USEREQUESTFORM for detecting it. But if the request form is used when runned from the form, there is no difference...

    But if you will change the form, and will call the report through variable, you can pass some flag through functions etc. See How To pass data into report...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    krikikriki Member, Moderator Posts: 9,090
    Or if you have some singleinstance codeunit, you can put in it some code to create global variables.
    Then in the form you set the global variable, in the report you test for it and then delete the global variable. This last in case you would then run the report from the object designer. If you didn't delete the global variable, it would still be there.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    awarnawarn Member Posts: 261
    Add a global variable, and a function to the report.

    Before you call it from a button, call the function and set the global variable.

    //call in code
    rReport.SetParameters(true);
    rReport.runmodal;

    //in report
    function SetParameters(_fromForm: boolean)

    GlobalCalledFromForm := _fromForm

    OnPreReport

    if GlobalCalledFromForm then begin
    //do whatever
    end;



    -a
  • Options
    dstiegeledstiegele Member Posts: 10
    awarn wrote:
    Add a global variable, and a function to the report.


    //call in code
    rReport.SetParameters(true);
    rReport.runmodal;

    -a

    That's right!
    But in this case: How can I suppress the upcoming filterdialog?
    (As I would do it in RUNMODAL(....))

    ...sorry for activating this one year too late!

    Thanks for your help!

    Dirk
  • Options
    krikikriki Member, Moderator Posts: 9,090
    repTheReport.USEREQUESTFORM(FALSE);
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.