Options

It's simple, but I'm sooo new!

demi222demi222 Member Posts: 131
In the order report I want a counter. When I print the report, I want it to add a column where it shows 1 and then the rest of the info,
2 and then the rest of the info...etc.

for example... in CRONOS the order report shows the following:

.................................................................... What I want is
No....Description...Quantity...Unit of Measure........ Number
1908.....printer .............1..............box ............................... 1
1906......ink...................5..............box................................ 2
1907......cable................3 .............box.................................3


I know its a counter I'm supposed to make. I'm new at programming as well as navision... please help me.
I start by declaring a variable Counts as an integer.

in C/AL I write:

Count:=0;
then something...
Count := Count +1;

Comments

  • Options
    ArhontisArhontis Member Posts: 667
    Hi,

    - Declare an global int variable name i.e. Counter.
    - On the OnPreDataItem place a line:
    Counter := 0;
    
    - On the OnAfterGetRecord place a line:
    Counter := Counter + 1;
    
    - Place a Text Box on the corresponding detail section that has a SourceExpr=Counter

    That is the main concept...
  • Options
    demi222demi222 Member Posts: 131
    Thank you!

    I'll definitely not ask this again...that was easy!
  • Options
    demi222demi222 Member Posts: 131
    Why is this not working for me today?

    I am trying to do the same thing, for the same report.

    On pre data item of the purchase header I put the code:
    Counters := 0;

    On after get record of the purchase header I put the code:
    Counters := Counters + 1;

    for the source expression of my text box that I have added on my report I have it set to Counters

    I have declared Counters as a global variable of typ integer.

    have I forgotten something?
  • Options
    ArhontisArhontis Member Posts: 667
    :?

    OnAfterGetRecord of the "purchase Header" or "Purchase Line"??

    Shouldn't you display and calculate under the "Purchase Line"?
  • Options
    demi222demi222 Member Posts: 131
    I tried that and it still didn't work.

    I have done all the combinations....

    on pre data item of purchase header Counters := 0;
    on after get record of purchase line Counters := Counters + 1;

    on pre data item of purchase header Counters := Counters + 1;
    on after get record of purchase line Counters := 0;

    on after get record of purchase header Counters := 0;
    on pre data item of purchase line Counters := Counters +1;

    on after get record of purchase header Counters := Counters + 1;
    on pre data item of purchase line Counters := 0;

    Don't know what else to do...
  • Options
    ArhontisArhontis Member Posts: 667
    If it is the report 405 then you could just place a textbox in the RoundLoop Body (4) that has a sourceExpr to Number. nothing else... This is report specific and the Purchase Line data item executes a CurrReportBreak, that means that it is not displayed. The items are shown with the RoundLoop data item. So if you don't want to use the "Number" value in the SourceExpr, then you could:

    * Create a global Counters of type Integer.

    * you must enter code to:
    RoundLoop - OnPreDataItem
    Counters := 0;

    * you must enter code to:
    RoundLoop - OnAfterGetRecord
    Counters := Counters+1;

    * On the Section RoundLoop Body (4) place on the start of it a textbox with SourceExpr to Counters;

    (The "Number" is a field of the "integer" virtual table.)

    If it is not the 405 report then on what report are you making your customizations, so I could replicate the problem...
    :roll:
  • Options
    demi222demi222 Member Posts: 131
    Thank you, it worked.
    The way I was thinking about it was wrong. I wasn't using the data item where the information was displayed (for example the Roundloop data item)
    I was thinking of where the data is coming from (Purchase line and header).

    I appreciate your help.

    Thank you
  • Options
    ArhontisArhontis Member Posts: 667
    Any time...
    :)
Sign In or Register to comment.