Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to scan/extract values from DBC
Message
 
 
To
29/07/2008 19:18:43
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01335076
Message ID:
01335145
Views:
12
Tracy,

Thank you very much. I will try it tomorrow.

>You can try this for a start (works for me):
>
>
>*--Name of dbc to scan
>lcdbc = 'Tracy.dbc'         && <--Change this
>*--Comment Value to look for
>lcComment = 'mycomment'     && <--Change this
>
>
>CLOSE ALL
>IF !FILE(lcdbc)
>	RETURN
>ENDIF
>USE (lcdbc) ALIAS mydbc
>
>CREATE CURSOR mycursor (cfieldname c(50), cclass c(100), cclasslib c(150))
>CLEAR
>select mydbc
>SCAN
>	IF !AT(lcComment,mydbc.property) > 0
>		LOOP
>	ENDIF
>	lxfound1 = .F.
>	lnpos1 = 0
>	lnpos2 = 0
>	lxfound2 = .F.
>	lxpos1done = .F.
>	lxpos2done = .F.
>	lcvalue1 = ''
>	lcvalue2 = ''
>	lcfieldname = ''
>	lcValues = mydbc.property
>
>	FOR i = 1 TO LEN(lcvalues)
>		IF !lxfound1
>			lnpos1 = AT(CHR(0)+CHR(0)+CHR(0)+CHR(1)+CHR(0)+CHR(50),lcvalues)
>			IF lnpos1 > 0
>				lxfound1 = .T.
>			ENDIF
>		ENDIF
>		IF !lxfound2
>			lnpos2 = AT(CHR(0)+CHR(0)+CHR(0)+CHR(1)+CHR(0)+CHR(51),lcvalues)
>			IF lnpos2 > 0
>				lxfound2 = .T.
>			ENDIF
>		ENDIF
>		IF !lxfound1 OR !lxfound2
>			EXIT
>		ENDIF
>		lcfieldname = ALLTRIM(mydbc.objectname)
>		IF !lxpos1done
>			i = lnpos1+6
>			lxpos1done = .T.
>		ENDIF
>		IF ASC(SUBSTR(lcvalues,i,1)) = 0
>			IF !lxpos2done
>				i = lnpos2+6
>				lxpos2done = .T.
>			ELSE
>				EXIT
>			ENDIF
>		ENDIF
>		IF !lxpos2done
>			lcvalue1 = lcvalue1 + SUBSTR(lcvalues,i,1)
>		ELSE
>			lcvalue2 = lcvalue2 + SUBSTR(lcvalues,i,1)
>		ENDIF
>	ENDFOR
>	insert INTO mycursor (cfieldname, cclass, cclasslib) VALUES (lcfieldname, lcvalue1, lcvalue2)
>ENDSCAN
>select mycursor
>browse
>
>
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform