overriding DataItemTableView

generaljimgeneraljim Member Posts: 8
It's been about a decade since I've been in the NAV world, so bear with me please. I’ve got a report running pretty well from a form via a Print button (it only prints the records that show on the form), but I can’t seem to get the sorting to be in the same order that it is on the form. I need to show the Options tab of the report, but don’t want the user to see the Request tab for the table that the report is based upon. So I had to set the DataItemTableView of the table on the report to get that tab hidden. Unfortunately that also seems to override the COPY I did from the Form’s Print button to get the filters and current key in play when running the report. Do I just have to let them see the table’s request tab by removing the DataItemTableView and make them go to the Options tab themselves? There’s a field on the Options tab that is required in order for the report to run. I *think* that’s the right answer, but I was hoping that there was some sort of change NAV did in the last decade that would allow me to get around this. Here's the code behind the Print button:


Thanks for any information on this.


  • Options
    SonGoten13SonGoten13 Member Posts: 44
    You could write a function in the report where you specify the key, set a flag or something.
    And in the OnPreDataItem of the DataItem in the Report you do the setcurrentkey.
    The Call of the Report looks then like this:
  • Options
    generaljimgeneraljim Member Posts: 8
    Thanks for the response. I ended up setting the DataItemTableView on the table to prevent the tab from appearing and then did the following to override that setting. I made the Print button do one additional thing from my previous post by calling a function in the report:


    And then the function getDorderRec in the report set a global variable gblDorders (DorderParam is the parameter with the Var checked):

    SetViewString := DorderParam.GETVIEW;

    And then in the OnPreDataItem trigger of the table in the report, I added this:


    Just trying to create a roadmap here for anyone needing to follow this later - myself included! :)

    Thanks again.
Sign In or Register to comment.