Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing string into a SQL statement
Message
From
22/12/2008 12:36:22
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01369199
Message ID:
01369205
Views:
9
You and Cetin are so good at this type of string manipulations. I wish I could think in those terms more often.

>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
>
Previous
Reply
Map
View

Click here to load this message in the networking platform