Adding section to C/AL Code..

Maybe a noob question, but I don't do a lot of coding, only has been with your help mostly.

When I design a report and go into view C/AL Code I will get sections like:

Documentation()

OnPreDataItem()

OnAfterGetRecord()

etc. Along with code underneath.

How do I add a section with code?

In my other report that works properly I have something that is CalcSizeStartPos() and some code. I want to add it to a copy of this report to see if it works. I think it will, and then I'll apply it to the actual report.


Answers

  • zohaibu95@hotmail.com[email protected] Posts: 223Member
    Documentation()

    OnPreDataItem()

    OnAfterGetRecord()


    These all are event triggers. Each event has its own life cycle.

    What do you meant by adding section with code? Do you want to add section in the layout? or do you want to add custom function in C/AL? like as u mentioned different events above?
    Best Regards
    Zohaib Ahmed
    Dynamics NAV ERP Technical Consultant.

    please like / agree / verify my answer, if it was helpful for you. thanks.
  • KishormKishorm Posts: 908Member
    The CalcSizeStartPos() is a function - you could add it but it won't do anything until you add some code somewhere to call it.

    It sounds like you're fairly new to this so if you want to start coding in NAV then it might be worth spending a bit of time with a developer to show you the basics. Good luck.
  • MisConsultngMisConsultng Posts: 17Member
    Depending on where your cursor is when you select Design on a Report object, you will be taken to the code section of that data item. I think that's where you are looking to add the code?

    For example a typical report data item structure might look like this:

    SalesHeader
    SalesLine
    Interger
    Footer
    etc.

    Depending on what you are trying to do, clicking on the first row for example and then hit F9 will take you to the code section of that section. I am guessing this is what you meant by section, though in designing report we often refer to Section as by going to the View menu on top and select Sections.

    Hope this helps.
  • yuppicide0138yuppicide0138 Posts: 3Member
    edited 2017-01-20
    Short version:

    So I have a report.. let's say Posted Sales Invoice. If I open that and hit F9 I have CalcSizeStartPos().

    The problem is on Posted Credit Memo report that does not exist. I need to get it on that report.

    We have something installed called "Matrix" which is for the apparel industry. Allows us to have sizes such as S, M, L, XL, 1X, 2X, 3X, O/S, etc. Anyway, not important.

    When I do a Credit Memo for an item that has sizes 1X, 2X, and 3X, they mistakenly show up under S, M, and L.

    Long version:

    Well.. I've been a member here awhile. Not that I'm skilled. Just that I've been on the forums a long time. I was yuppicide. Unfortunately when the new forums switched over I couldn't get in, so I created a new name. I hardly use the forums any more because I don't remember how to get in. As we speak the yuppicide0138 didn't work for me to login and reply, but now yuppicide is working. Odd.

    Anyway, we have Navision 3.10. Some of our machines run Windows XP still :( and some are running Windows 7 now with Virtual XP.

    We used to have a partner which we paid a fee to, but the fee was expensive. We're just a small company of under 10 computers. It wasn't worth paying a maintenance fee because we never needed them. Navision works, we back it up, etc.

    Anyway, I do dabble in a little programming and I can understand certain things, so they created me a super user account before we ended our support contract with them.

    It's not often that we modify things in Navision. I did create a few useful things of my own, but most of the time I'm just trying to fix errors that have been there since, what year 2002 or so whenever this version came out.

    I saw some old documents from our Navision partner that they tell you to test everything and make sure it all works within 30 days I think it was. Within that time period they would come back and fix anything needed. Thing is it's 2016 and they still haven't used all the features or found all the errors. No way we'd have seen them all in 30 days time.

  • ftorneroftornero Posts: 274Member
    Looks like CalcSizeStartPos() is a function inside the Posted Sales Invoice report that you need to copy/paste into the Posted Credit Memo report and make that works.

    It's an educated guess.

    If you want to we can connect with some kind of remote software (TeamViewer or even Skype) and I could take a look to that.

    Regards
  • pavithrap0992pavithrap0992 Posts: 21Member
    Open the C/AL Globals in the Posted Sales Invoice report and you will find CalcSizeStartPos under the Functions tab. Select that line, copy it and paste it in the Globals of Posted Credit Memo Report.
  • yuppicide0138yuppicide0138 Posts: 3Member
    Thanks. That's what I needed to continue. What CalcSizeStartPos was called and where to add it. Hopefully I can figure the rest out.
    Open the C/AL Globals in the Posted Sales Invoice report and you will find CalcSizeStartPos under the Functions tab. Select that line, copy it and paste it in the Globals of Posted Credit Memo Report.


Sign In or Register to comment.