Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: dragon 5
  Where is dragon 5?
 Johor
 Malaysia
 dragon 5
 To: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 Tags
Subject: RE: Generate all possible number
Thread ID: 267501 Message ID: 269118 # Views: 22 # Ratings: 0
Version: Visual FoxPro 6 Category: VFP and .NET
Date: Friday, July 16, 2010 12:24:47 PM         
   


> >
> > Thanks for reply, but I must do the combination in the programing without using the sql method.
> > Any idea?
> >
> > Thanks.
> >
> >
> > peng
>
> Why not SQL?
> Please check again, i'm not 100% sure.
>
DIMENSION aResults[1]
> Permutation('5084')
> DIMENSION aResults[ALEN(aResults)-1]	&& remove last el
> =ASORT(aResults)	&& you sort it...
> =ACOPY(aResults,aNewResults,2)	&& copy to new array, move elements 1 up
> aNewResults[ALEN(aResults,1)]=0	&& replace .f. with 0
> FOR i =1 TO ALEN(aResults,1)
> 	IF aResults[i]<>aNewResults[i]
> 		? aResults[i]	&& if not same, it's not duplicate.
> 	ENDIF 
> NEXT 
> ***************************
> function Permutation
> lparameters tcWord,tcPrefix
> 
> if empty(tcPrefix)
>   clear
>   tcPrefix=""
> endif
> do case
> case len(tcWord)=0
>   *Nothing to do
> case len(tcWord)=1
>   	aResults[ALEN(aResults)]=VAL(tcPrefix+tcWord)
>   	DIMENSION aResults[ALEN(aResults)+1]
> otherwise
>   local xx
>   for xx=1 to len(tcWord)
>     Permutation(left(tcWord,xx-1)+substr(tcWord,xx+1),tcPrefix+substr(tcWord,xx,1))
>   endfor
> endcase
> 

>
> Regards
> Samir


It is because that is the requirement of the project.
I cannot use the SQL.
I want to get the combination, not the permutation.

Thanks for Mr Samir.H for try to help me.
If can, please help me to get the combination of number without using SQL.

Thanks a lot.

peng

ENTIRE THREAD

Generate all possible number Posted by loo peng @ 7/5/2010 11:21:43 AM
RE: Generate all possible number Posted by tushar @ 7/5/2010 11:30:08 AM
RE: Generate all possible number Posted by loo peng @ 7/5/2010 12:23:58 PM
RE: Generate all possible number Posted by Anders Altberg @ 7/5/2010 12:29:57 PM
RE: Generate all possible number Posted by loo peng @ 7/5/2010 12:59:38 PM
RE: Generate all possible number Posted by Samir H. @ 7/5/2010 1:17:12 PM
RE: Generate all possible number Posted by Anders Altberg @ 7/5/2010 1:45:29 PM
RE: Generate all possible number Posted by Samir H. @ 7/5/2010 1:59:12 PM
RE: Generate all possible number Posted by Anders Altberg @ 7/5/2010 3:10:12 PM
RE: Generate all possible number Posted by Anders Altberg @ 7/5/2010 3:49:17 PM
RE: Generate all possible number Posted by Anders Altberg @ 7/5/2010 3:49:19 PM
RE: Generate all possible number Posted by Samir H. @ 7/5/2010 4:07:49 PM
RE: Generate all possible number Posted by Samir H. @ 7/5/2010 12:50:42 PM
RE: Generate all possible number Posted by loo peng @ 7/5/2010 12:57:15 PM
RE: Generate all possible number Posted by Samir H. @ 7/5/2010 1:06:01 PM
RE: Generate all possible number Posted by Samir H. @ 7/5/2010 1:10:38 PM
RE: Generate all possible number Posted by loo peng @ 7/10/2010 11:58:40 AM
RE: Generate all possible number Posted by Samir H. @ 7/10/2010 2:57:10 PM
RE: Generate all possible number Posted by loo peng @ 7/16/2010 12:24:47 PM
RE: Generate all possible number Posted by Samir H. @ 7/16/2010 12:27:23 PM
RE: Generate all possible number Posted by loo peng @ 7/16/2010 12:50:56 PM
RE: Generate all possible number Posted by Anders Altberg @ 7/10/2010 4:09:21 PM
RE: Generate all possible number Posted by loo peng @ 7/16/2010 12:27:41 PM
RE: Generate all possible number Posted by Anders Altberg @ 7/5/2010 11:53:48 AM
RE: Generate all possible number Posted by Anders Altberg @ 7/5/2010 1:56:46 PM
RE: Generate all possible number Posted by Anders Altberg @ 7/5/2010 3:40:38 PM
RE: Generate all possible number Posted by Samir H. @ 7/5/2010 3:49:39 PM
RE: Generate all possible number Posted by Anders Altberg @ 7/5/2010 4:26:22 PM
RE: Generate all possible number Posted by Tony Vignone @ 7/17/2010 9:16:15 PM