Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extracting info from a memo field into a grid
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00817728
Message ID:
00818716
Views:
14
Try
CREATE CURSOR crsValues ( ;
	FldName C(10), ;
	OldLen I, NewLen I, ;
	OldFldVal C(32), NewFldVal C(32))
SCATTER NAME oRec

SELECT mytable
lcMemo = mymemo

lnCnt = 1
lnPos = AT("xxx", lcMemo, lnCnt )
DO WHILE lnPos > 0
	oRec.OldLen = INT(VAL(SUBSTR(lcMemo,lnPos-10,5)))
	oRec.NewLen = INT(VAL(SUBSTR(lcMemo,lnPos-5,5)))
	oRec.FldName = SUBSTR(lcMemo,lnPos+3,10)
	
	lnValPos = lnPos + 13
	oRec.NewFldVal = SUBSTR(lcMemo, lnValPos, oRec.NewLen) 
	IF oRec.OldLen > 0
		oRec.OldFldVal = SUBSTR(lcMemo, lnValPos + oRec.NewLen, oRec.OldLen) 
	ELSE
		oRec.OldFldVal = ""
	ENDIF	
	
	INSERT INTO crsValues FROM NAME oRec

	lnCnt = lnCnt + 1
	lnPos =  AT("xxx", lcMemo, lnCnt )
ENDDO
>I have a table which is from a Foxpro Application generated from a Supplier (I do not have access to the source code). In one of the fields based on the deign number is a field called DATA this is a memo field. When you double click the field in the table you get the following:
>

> 10 10xxxCHANGEDATE02/08/200201/08/2002 8 8xxxCHANGETIME16:56:4814:56:45 2 2xxxCHANGEINITLFMA 5 5xxxCHANGENUM 48 47 0 1xxxCHK17 X 0 2xxxCHK17INIT LF 0 10xxxCHK17DATE 18/07/2002 0 8xxxCHK17TIME 14:09:31 15 15xxxLASTEDIT1 PDM1 821430PDM1 817305 15 15xxxLASTEDIT2 PDM1 817305PDM1 816340
>
>I would like to read this into a grid 3 columns. So that the format would be shown for the above like:
>
>
>Fieldname      Old Data        New Data
>
>CHANGEDATE     14:56:45        16:56:48
>CHANGEINIT     MA              LF
>CHANGENUM      47              48
>CHK17          0               X
>
>etc etc
>
>
>As you can see from the contents of the file after every field type CHANGEDATE or CHANGEINIT the new data is next to it and the old one is the next value.
>
>If anybody could help me I would be very grateful as in giving me a starting point!
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform