Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Do level exceeded error
Message
From
17/10/2001 17:21:56
 
 
To
17/10/2001 14:58:13
Leshel Rich
Plains Cotton Coop Assoc
Lubbock, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00569846
Message ID:
00569927
Views:
23
>Can someone offer any suggestions on how to clean up this code? My problem is that the customer number can have more than the allowed do nesting level occurrances of a specific sales order number. Below is the code for my DO WHILE. Note that the code is in a function called l_upddtl, and this code is calling that function, so there is a recursive call to that function within itself. HELP!!!
>*-- Scan through all item in sales order
>  DO WHILE a_tmpf1->sono + a_tmpf1->custno = lc_cmpsono + lc_cmpcust AND ;
>           NOT Cl_CmpDone
>
>    *-- Update record number in array
>    la_shipcmp[Cn_CurRec] = RECNO()
>
>    *-- Update gets and set validation flags
>    = w_browse()
>
>    *-- Validate item
>    IF l_upddtl(.t.)
>      *-- Record is valid and has been saved
>      SKIP
>
>      *-- Store new position to ship complete array
>      la_shipcmp[Cn_CurRec] = RECNO()
>
>      IF EOF("a_tmpf1")
>        *-- End of file, complete shipment is done
>        la_shipcmp[Cn_Done] = .t.
>        ll_return = .t.
>
>        *-- Skip back one to position on last item of Sales Order
>        SKIP -1
>      ELSE
>
>        *-- Check if complete shipment is done
>       IF la_shipcmp[Cn_SavSono] <> a_tmpf1->sono
>          *-- We are are on a different sales order, complete is done
>          la_shipcmp[Cn_Done] = .t.
>          ll_return = .t.
>
>          *-- Skip back one to position on last item of Sales Order
>          SKIP -1
>
>        ENDIF
>
>      ENDIF
>
>
>    ELSE
>      ll_return = .f.
>
>      *-- Exit, so we can correct invalid get
>      EXIT
>    ENDIF
>
>  ENDDO
>Thanks!

Some thoughts:


It seems that every time a customer order is completed, the recursive call occurs. There's no need to do that. The looping structure you have seems to be capable of moving from one order to the next.

It might help, as a start, to move the code from the l_upddtl procedure here to the loop. Take out the call in that code to this procedure and see if it works.

If that doesn't help, I find that writing down in English what the routine is supposed to do, then using my understanding of Fox gets me moving.


Jay
Previous
Reply
Map
View

Click here to load this message in the networking platform