Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Putting a cursor row into an array
Message
From
16/10/2002 16:28:44
 
 
To
16/10/2002 16:10:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00711958
Message ID:
00711973
Views:
7
>I have imported a text file into a cursor and am trying to parse the data. I have a row of data that I would like to put into an array so that I can do some other things with it. Doing a select statement won't work. Is there anyway that I can tell it what row I want to put into the array. Please help! BTW...I am still using VFP 5.0...but we will be converting to VFP 7.0 within the next couple of weeks...I can't wait!

If you want to know what field as well as the value, you can try something like RowToArray function in this example:
CREATE TABLE DaysOfWeek (ID I, DAYOFWEEK C (9))
INSERT INTO DaysOfWeek VALUES (1,CDOW(DATE()+1))
INSERT INTO DaysOfWeek VALUES (2,CDOW(DATE()+2))
INSERT INTO DaysOfWeek VALUES (3,CDOW(DATE()+3))
INSERT INTO DaysOfWeek VALUES (4,CDOW(DATE()+4))
INSERT INTO DaysOfWeek VALUES (5,CDOW(DATE()+5))
INSERT INTO DaysOfWeek VALUES (6,CDOW(DATE()+6))
INSERT INTO DaysOfWeek VALUES (7,CDOW(DATE()+7))

GO 5

LOCAL laDayOfWeek[1]

RowToArray(@laDayOfWeek,"DaysOfWeek")

LIST MEMORY LIKE laDayOfWeek

FUNCTION RowToArray(taArray, tcAlias)
	LOCAL lni, taArray[FCOUNT(tcAlias),2], lcField
	FOR lni = 1 TO FCOUNT(tcAlias)
		lcField = FIELD(lni,tcAlias)
		taArray[lni,1] = lcField
		taArray[lni,2] = &tcAlias..&lcField
	NEXT lni
ENDFUNC
Previous
Reply
Map
View

Click here to load this message in the networking platform