Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hard to explain - Building SQL
Message
From
14/01/2009 18:02:11
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01373759
Message ID:
01373790
Views:
27
You understood perfectly. I always forget that I can start the FOR in the middle of the count, not always from the beginning. Thanks!

>If I undestood you correctly, I think a simple FOR loop after the SCAN should do it
>
>
>	m.ix = 0
>	SCAN
>		m.ix = m.ix + 1
>		lcFields = lcFields + IIF(m.ix > 1, ', ','') + ALLTRIM(FieldName) + ' AS Fld'+TRANSFORM(ix)
>	ENDSCAN
>	for m.ix = m.ix to 8
>		lcFields = lcFields + IIF(m.ix > 1, ', ','') + ' [ ]AS Fld'+TRANSFORM(ix)
>	next i
>	lnReportColumnCount = m.ix
>	RunSQL = 'SELECT ' + lcFields + ' FROM ' + lcTable + ' ORDER BY ' + lcOrderField + ' INTO CURSOR ReportCursor'
>	&RunSQL
>
>
>* Update, of course you needed to remove the field name from the expression in the FOR
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform