Dynamic Array!!!

lilianatavareslilianatavares Member Posts: 39
Does dynamic array exist in Navision?
Do they know how to implement?

I want to do a cycle repeat until to fill an array with customers and to show in a report. I know that other solution exists.

For example
aux:=10000..80000;
customer.SETFILTER(customer "no.",aux);
IF customer.FIND (' - ' )THEN
REPEAT
BEGIN
cust:=customer.name;
i:=i+1;
END;
UNTIL customer.NEXT=0

And in the report I want to show the cust values.

How do I can you make it?

Thank you
:?

Comments

  • kinekine Member Posts: 12,562
    through some temporary table that have primary key field of type integer and some field of type text. Fill this temporary table and print as if you have other tables.... 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,307
    Why would you want to fill an array with the values of a customer recordset that you have ready to be used in your report? All you need to do to display your customer information is put the fields on a section and you're done. If you don't want all of them according to certain restrictions, you program that condition in the OnAfterGetRecord and do a CurrReport.SKIP if the record does not meet the condition. I think you are thinking a little too complicated there.

    By the way, you don't need the BEGIN and END inside the REPEAT UNTIL loop. I always put those outside the REPEAT loop, just in case I want to do something outside the loop but inside the condition.
  • lilianatavareslilianatavares Member Posts: 39
    Another example:

    aux := 10000 ..80000;
    customer.SETFILTER(customer. no. " ,aux);
    IF customer.FIND (' - ' )THEN
    REPEAT
    " Detail Cust. ledg. Entry ".SETFILTER (" Detail Cust. ledg. Entry "."Customer no. " ,aux);
    IF " Detail Cust. ledg. Entry ".FIND (' - ' )THEN
    REPEAT
    aux := " Detail Cust. ledg. Entry " .amount;
    i:=i+1;
    UNTIL " Detail Cust. ledg. Entry ".NEXT=0;
    UNTIL customer.NEXT=0;

    This code is written in the customer body.
    And to print in the report the different lines.
    one for the customer 10000 and the balance
    one for the customer 20000 and the balance
    ....
    one for the customer 80000 and the balance
  • DenSterDenSter Member Posts: 8,307
    OR: you add the standard Navision Balance field that is in the customer table to your customer dataitem. Maybe you need a CALCFIELD in the OnAfterGetRecord trigger of the customer dataitem, but you are thinking WAY too complicated. If you need detailed information (like all the amounts of the customer ledger entries), you should just add and indent a customer ledger entry dataitem and link it to your customer.

    By the way, I hope you are not programming this in any of the section triggers, that is NOT the place to put this code. If you insist on doing it that way, you should write all of that code in the OnAfterGetRecord trigger.
Sign In or Register to comment.