Automating adding the same code to hundreds of reports

JosephGressJosephGress Member Posts: 36
edited 2010-12-22 in NAV Three Tier
I have a project where I will need to add the same code to several hundred reports in NAV. And, I may need to do this in several databases.

I am looking for the best way to automate this process.

The code is very simple: declare a global variable then add 2 or 3 lines of code to the OnInitReport trigger in each report.

I've noticed in NAV2009 that you can export objects in xml format. I suspect that this may be the way to go for this project. However, I am relatively new at working with XML.

My questions are:

1) Are there other approaches that you have used to automate adding the same code to many objects in NAV?
2) I know there are many tools that are available for working with XML data. What tools do you recommend for my project? Also, let me know if you are aware of any books or online documentation that were helpful for you in learning to use these tools.
3) Are there any gotchas that I should look out for in doing this project?

Thanks

Joseph
Joseph Gress

Comments

  • pdjpdj Member Posts: 643
    Based on your description I fear you are trying to do something that can be done very simple.
    http://dynamicsuser.net/blogs/mark_brum ... usage.aspx
    How is my guessing? :?:
    Regards
    Peter
  • JosephGressJosephGress Member Posts: 36
    Thanks PDJ and Mark! :thumbsup: PDJ guessed exactly what I was trying to do--recording when a report was last used; who used it; how often it was used and so on. That was great information.

    Mark's blog posting about adding code to the FindPrinter function in Codeunit 1 works beautifully for reports.

    Now, I want to do the same thing (record when they were last used, etc) for forms and dataports. Unless I'm missing something, the same trick won't work for these objects.

    So, I'm back to my original questions:

    1) Are there other approaches that you have used to automate adding the same code to many objects in NAV?
    2) I know there are many tools that are available for working with XML data. What tools do you recommend for my project? Also, let me know if you are aware of any books or online documentation that were helpful for you in learning to use these tools.
    3) Are there any gotchas that I should look out for in doing this project?
    Joseph Gress
  • aseigleaseigle Member Posts: 207
    Did you consider setting up Change Log? Surely you don't want to know EVERY time a form is used, and you are focused on key fields?
  • JosephGressJosephGress Member Posts: 36
    Regarding Aseigle's question "Did you consider setting up Change Log?", that might work for forms that are not readonly. I will test adding the code to add an Object Usage record to the GetGlobalTableTriggerMask function in Codeunit 1.

    Thanks for the suggestion!
    Joseph Gress
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I would try using security on form level.

    By default Navision allows users to use form 0 in the ALL role.

    I don't like that.

    My advise to customers is to setup security on all objects, not only tables. This way you can also see which objects are really used.

    You can start with adding all forms to one ALLFORM role and start stripping slowly.

    If an user cries that something does not work, it's fixed in 5 seconds.
  • DenSterDenSter Member Posts: 8,304
    the infamous Dutch 'piep' system :mrgreen:
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
  • JosephGressJosephGress Member Posts: 36
    Thanks Mark for the suggestion of using security to find out whether certain forms are being used or not. I have mixed feelings about that approach. On the one hand, it is easy and fast to implement and I think it would be pretty effective. On the other hand, it prevents users from trying out forms that they haven't used before. I think that if a user doesn't have rights to a given form they don't see it in their menu. It could lead to the same form being created multiple times. But it is simple.

    Thanks again. :wink:
    Joseph Gress
Sign In or Register to comment.