Processing Reports vs. Codeunits

Mike_HWGMike_HWG Member Posts: 104
Hey all,

I'm trying to increase my knowledge of best practices.
I thought I had seen a discussion on this before, but I can't find it.

Codeunits vs Processing-Only Reports
1. Is there any performance difference?
2. Is there a clear reason to use one over the other?


My guesses is that a codeunit would have a smaller object size and lower memory footprint - not enough to matter in this day and age, just something to think about. I'm also betting the codeunit runs faster. My guesses is because there's less to compile - no pre-defined properties settings, etc., that get front-loaded by the code.
Lastly, a codeunit frees up licensing space for other reports that may not have a direct codeunit translation.

Thoughts?
Michael Hollinger
Systems Analyst
NAV 2009 R2 (6.00.34463)

Comments

  • davmac1davmac1 Member Posts: 1,283
    Most end users have report development licenses but not codeunits.
    Reports have a built in processing cycle so are very easy compared to codeunits. (Though some reports ignore the processing cycle - no data sections).
    Most end users have 100 custom report objects but not always codeunits.

    Codeunits can be much faster because you control the processing.

    For best speed, you can't beat SQL. SQL updates should be used only in special situations where the processing is not using hard to reproduce NAV business logic and is best checked out a test database first, since you can really mess up a database wit SQL done wrong.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    If you don't know what you're doing, use Process only reports.

    Performance wise, they're both the same.
  • davmac1davmac1 Member Posts: 1,283
    If you don't know what you're doing, use Process only reports.

    Now that sounds like an invitation to disaster! :)

    (I know that is not what you meant, but someone who shouldn't may take it literally....)
  • DenSterDenSter Member Posts: 8,305
    I'd say if you don't know what you're doing, use neither and let a professional take care of it. Even then, there are so-called 'professionals' in here that don't know what they're doing either, so that's a complete wash too :mrgreen:

    The biggest advantage of a report object is that it provides a very easy way to get user input, which is very difficult to do with a codeunit. If you need user input, use a report. If you don't need user input it's up to you. Some people like how a report objects is an easy looping mechanism. It kind of visualizes the nesting in the data, so it is a little bit easier to program. It's a feel thing I think, more than anything, personal preference.
Sign In or Register to comment.