Report request form how to check fields

mr.burnsmr.burns Member Posts: 39
edited 2014-12-01 in NAV Three Tier
Hi all,

I have a report using a request form with several text fields, check boxes etc..
If I click the OK button I want to make sure that text fields are not empty.
How can I do that? I cannot find any trigger which is executed if I click the OK button.
If I put my 'check'-code inside the OnPreDataItem of first Dataitem it is too late since the request form is already closed.

Thanks for any help!


  • Options
    vijay_gvijay_g Member Posts: 884
    You can put your 'check'-code inside the OnPrereport trigger.
  • Options
    mr.burnsmr.burns Member Posts: 39
    Hi vijay_g,

    thanks for reply, but unfortunately this also dos not work.
    The request form is already closed if I run the code inside OnPreReport.

    What I need is that the user stays on the request form until he has entered something inside the textfield.
    So what should happen:

    1. Request form opens, textfield is empty
    2. User does not enter something in texfield
    3. User clicks OK on request form
    4. Code must be executed and check if textfield is empty
    5. If textfield is empty, request form must not close and user gets message to enter something into textfield then back to point 3.
    6. If textfield contains something the request form is closed and report runs as usual.

    Thanks for any further help!
  • Options
    ChinmoyChinmoy Member Posts: 359
    I don't think this is possible through Request Form. You can do it through a standard NAV form. Run the form take the inputs from the user, validate them and then run the report.

  • Options
    mr.burnsmr.burns Member Posts: 39
    Hi Chinmoy,

    thanks for reply. I think / feel the same. So I will deal with an extra form.
  • Options
    ChinmoyChinmoy Member Posts: 359
    There is one more crude method that comes to my mind, if you check the values in the OnPreReport and find that they are invalid, you can actually use Report.Run(<The same report object no.>) and then give an error message which will close the current report.

    However, the parameter values which the user may have entered in the request form will be blanked out.

  • Options
    okioki Member Posts: 46
    The solution for this is the OnQueryClosePage()-trigger in the C/AL-code editor.
    Here you can test, show a message and exit the trigger with FALSE.
    So the page stays open and the values are still there.
    If the check is successful exit with TRUE.
    You can also determine, which button the user has pressed. It's the call parameter of the trigger.
    If he has pressed CANCEL you can immediate leave the trigger with return value TRUE.
  • Options
    vijay_gvijay_g Member Posts: 884
    I was also trying with this trigger but when the error comes navision get closed and the most intresting thing is when you come out from your report(on object designer) you will still getting this error and the result is you can not close object designer too.
  • Options
    DralDral Member Posts: 7
    I guess you have already figured that out yourself, but just as remark:
    OnQueryClosePage(CloseAction : Action None) : Boolean
      IF tCodeunitNo = '' THEN ERROR(ERR_CuNo);
      IF tObjectRange = '' THEN ERROR(ERR_FILTER);
    Alex Dragojevic
Sign In or Register to comment.