Is a menu item (report) is executed from the menu or from a form?

If executed from the menu I want to see the Dialog box (parameter and printer settings);
if executed from a form, I want to hide the parameters or the dialog box at all (in some cases)

In the controller class I found parmShowDialog() to suppress the dialog;
and getCachedUIBuilderForDataContractInfo() to suppress parts of the dialog.

Maybe I can create 2 menu items and set the "parm" property in order to control it,
but: there should be a smarter solution, I think ;-)

  • I would indeed use two separate menu items with an enum parameter defining the requested behavior. It seems better to me than hiding the logic somewhere inside the controller.

    I can imagine how somebody would try to use your report in a different context (maybe a few years later) and your logic would cause incorrect behavior with no obvious reason. Such things increase maintenance cost of the ERP system (which is a major problem on many projects).

    Two menu items with descriptive names not only do the job, but they also clearly document what's the difference in behavior, and developers can achieve the behavior needed in each particular case by simply picking the right menu item.
  • put this at report init:

    public void init()
    if (this.args().caller())
    info("there is a caller");
    info("no caller");