Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hard to explain - Building SQL
Message
From
14/01/2009 17:10:24
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Hard to explain - Building SQL
Miscellaneous
Thread ID:
01373759
Message ID:
01373759
Views:
82
I'm using this in a report, works great except that there are fields on the report that may not be in the SQL results. I need to be able to include this in the SQL if the number of records (m.ix or lnReportColumnCount) is only 4:
" ' ' AS Fld5, ' ' AS Fld6, ' ' AS Fld7, ' ' AS Fld8"
But this if the number of records is 6:
" ' ' AS Fld7, ' ' AS Fld8"
This is a section of the block of code:
	m.ix = 0
	SCAN
		m.ix = m.ix + 1
		lcFields = lcFields + IIF(m.ix > 1, ', ','') + ALLTRIM(FieldName) + ' AS Fld'+TRANSFORM(ix)
	ENDSCAN
	lnReportColumnCount = m.ix
	RunSQL = 'SELECT ' + lcFields + ' FROM ' + lcTable + ' ORDER BY ' + lcOrderField + ' INTO CURSOR ReportCursor'
	&RunSQL
Next
Reply
Map
View

Click here to load this message in the networking platform