Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to list all combinations.
Message
De
09/05/2008 08:27:03
 
 
À
09/05/2008 04:16:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01315740
Message ID:
01316042
Vues:
17
>Thanks Tamar but unfortunately I don't have any issues of Foxpro Advisor. Any chance you could send me the code.

Haven't looked at this in a long time, but here's the code:
LPARAMETER nCount, nSetSize

* Parameter checking omitted

*!*	* The array for results must be private
*!*	DIMENSION aResult[1, nSetSize]
PRIVATE nRecCount

* Create a cursor to hold results
cFieldList = ""
FOR nItem = 1 TO nSetSize
	cFieldList = cFieldList + "Item" + TRANSFORM(nItem) + " N(4),"
ENDFOR
cFieldList = LEFT(cFieldList, LEN(cFieldList)-1)
CREATE CURSOR Results (&cFieldList)

nRecCount = 0

GetNextValue(nCount, nSetSize, 1, 1)

RETURN nRecCount

PROCEDURE GetNextValue
LPARAMETERS nCount, nSetSize, nStartPos, nResultPos

* Parameter checking omitted

LOCAL nPos, nOldRecCount

FOR nPos = nStartPos TO nCount-nSetSize+nResultPos
   nOldRecCount = nRecCount
   
   * Drill down first
   IF nResultPos<nSetSize
      GetNextValue(nCount, nSetSize, nPos+1, nResultPos+1)
   ENDIF
   
   * Save results
   IF nResultPos=nSetSize
      nRecCount = nRecCount + 1
      APPEND BLANK IN Results
   ENDIF
   GO nOldRecCount + 1
   SCAN REST
      REPLACE ("Item"+TRANSFORM(nResultPos)) WITH nPos IN Results
   ENDSCAN
ENDFOR

RETURN
Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform