Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing string into a SQL statement
Message
 
To
22/12/2008 12:16:17
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01369199
Message ID:
01369202
Views:
9
Somthing like this? (Quick solution, not even declared variables)
? Parse("Race.RaceCode, RaceDesc")

function Parse(vNewVal)
nPoint	= At('.', vNewVal)
cSelect	= []
if nPoint > 1
	cAlias	= Left(vNewVal, nPoint - 1)
	cSelect	= [SELECT ]
	for nLine = 1 to Alines(laLines, Substr(vNewVal, nPoint + 1), 1 + 4, ',')
		cSelect	= cSelect + Iif(nLine = 1, [], [, ]) + laLines[nLine] + [ AS F] + Transform(nLine)
	next nLine
	cSelect	= cSelect + [ FROM ] + cAlias
endif
return cSelect
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform