Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
For-loop handling on String and Array..
Message
De
02/01/2004 03:17:40
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
For-loop handling on String and Array..
Divers
Thread ID:
00863386
Message ID:
00863386
Vues:
41
My Mind is Nested... ~>_<~

The Coding below work right on:
Pre-Condition: AChecks(9999) is an Array carry simple .T. or .F.
Post-Condition: CTNLIST show out the Simplest form on number list, Carry the Carton# of used.

How to make another CTNMISS carry the .F. List, which mean missing Carton#

For example,

ITEM# CTN_NOS
A111 003,005-008
B222 004,007-012
C333 014,016,020-030

Result:
CTNLIST: 003-014,016,020-030
[b]How to modify the below coding to give this Expected CTNMISS:
013,015,017-019[/b]

Another String Carry Duplicate Carton# is simply done as similiar copy of below For-loop.

I have tried a whole day on adding new code, but still fail of my expect result...
Thus, post the correct starting code for you on helping me...

Thank you.

[pre]
* STD: AChecks()
CTNLIST = "" && CARRY REAL CTN_NOS, CTNCHECK
CTNMISS = "" && CARRY CTN MISSED
CTNLEN = 0 && LEN OF CTN MSG SHOW
LASTTAKE = 0 && LAST CTN IS .T. TAKEN
LASTSKIP = 0 && LAST CTN IS .F. SKIP
LASTCTN = 0 && LAST CTN# OF 003-00#
LASTMISS = 0 && LAST MISS# OF 004-00#
FOR IK = 9999 TO 1 STEP -1
IF ACHECKS(IK) = .F.
IF EMPTY(CTNLIST) && EMPTY TAIL
LOOP
ENDIF
* FEED HEAD CARTON#
IF (LASTSKIP = IK + 1) .OR. ( LASTCTN = IK +1) && LAST .F. (SKIP CASE), UNIQUE CTN
* DO NOTHING
ELSE
CTNLIST = PADL(IK+1, CTNLEN, '0') + '-' + ALLTRIM(CTNLIST)
ENDIF
LASTSKIP = IK
ELSE
IF EMPTY(CTNLEN) && 1ST .T.
CTNLEN = CEILING( LOG(IK+1)/LOG(10) ) && BETWEEN 10^X
CTNLIST = PADL(IK, CTNLEN, '0') && SHOULD FIT
LASTTAKE = IK
LASTCTN = IK
LOOP
ENDIF
IF LASTTAKE = IK + 1 && LAST .T.
IF IK = 1
CTNLIST = PADL(1, CTNLEN, '0') + '-' + CTNLIST
ENDIF
ELSE
CTNLIST = PADL(IK, CTNLEN, '0') + ',' + CTNLIST
LASTCTN = IK
ENDIF
LASTTAKE = IK
ENDIF
ENDFOR
[/pre]
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform