How recursion is possible in record level.

deepthi.vdeepthi.v Member Posts: 62
Hi all,

I am using nav 3.7 .
I want to get the data in the form that displays the item Production BOM components And their components of each item till the item is not having bom.

How can we do this..


Ex: Item A is having 4 components in its Production BOM.

A1,A2,A3,A4
and in A1 again it is having 2 Components then
A11,A12 and in A11 there is again one component A111

I want to display all the components of A.


Help me please....


Thanks in Advance
Deepu :-k

Comments

  • matttraxmatttrax Member Posts: 2,309
    Recursion is always the same
    Function(param)
       IF some condition THEN
          Stop Execution
       Code
       Possibly More Code
       Function (some other param)
    

    If NEXT returns 0 that is probably you condition to stop.
  • krikikriki Member, Moderator Posts: 9,110
    Important is that in your recursive function, the variables you use must be defined locally and not globally.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • DenSterDenSter Member Posts: 8,304
    Make sure that you program a failsafe in to prevent infinite recursion, for instance if A is a component of B, and B is a component of A at the same time.
  • idiotidiot Member Posts: 651
    The limit in NAV recursion reaches very quickly with the system will throw out some error due to the limit of NAV memory handling. You are better off using temp table.
    NAV - Norton Anti Virus

    ERP Consultant (not just Navision) & Navision challenger
Sign In or Register to comment.