Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to list all combinations.
Message
From
09/05/2008 08:27:03
 
 
To
09/05/2008 04:16:43
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01315740
Message ID:
01316042
Views:
15
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform