Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying from one array to another
Message
From
10/08/2005 19:03:57
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01040013
Message ID:
01040042
Views:
21
This message has been marked as a message which has helped to the initial question of the thread.
>I have a two dimensional array - site,security. I want to create a two dimensional array of - site,security - for security = '2'.
>
>Thanks
>
>Brenda
CLEAR
DIMENSION site_security[4,2]

site_security[1,1]='SiteA'
site_security[1,2]='3'

site_security[2,1]='SiteZ'
site_security[2,2]='2'
site_security[3,1]='SiteT'
site_security[3,2]='2'

site_security[4,1]='SiteW'
site_security[4,2]='1'

=ASORT(site_security,2,-1,0)
* FIND FIRST ROW
r1=ASCAN(site_security,'2',-1,-1,2,8)
IF EMPTY(m.r1)
	RETURN 0
ENDIF
* FIND NEXT GROUP ROW
FOR R2=m.r1+1 TO ALEN(site_security,1)
	IF NOT site_security(m.R2,2)=='2'
		EXIT
	ENDIF
NEXT
* build result space
DIMENSION aResult(m.r2-m.r1,ALEN(site_security,2))
* fill result space
=ACOPY(site_security,aResult,AELEMENT(site_security,m.r1,1))
DISPLAY MEMORY LIKE aResult
RETURN ALEN(aResult,1)
Previous
Reply
Map
View

Click here to load this message in the networking platform