Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Repeating code in IF ELSE ENDIF
Message
From
14/01/2009 15:54:04
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01373379
Message ID:
01373721
Views:
19
That is exactly what I ended-up doing. I was just trying to find a way - not sure why really - that didn't involve evaluating the values twice.

>
>IF !EMPTY(ALIAS())
>	LOCAL ;
>		lcTable, ;
>		lcFields, ;
>		lcOrderField
>	lcFields = ''
>	lcTable = ALLTRIM(UPPER(JUSTSTEM(ALIAS())))
>	lnColumnCount = FCOUNT(lcTable)
>	IF lnColumnCount = 2
>		FOR ix = 1 TO lnColumnCount
>			lcFields = m.lcFields + IIF(m.ix > 1, ', ','') + FIELD(ix) + ' AS Fld'+TRANSFORM(ix)
>			IF m.ix = 1
>				lcOrderField = FIELD(ix)
>			ENDIF
>		ENDFOR
>		RunSQL = 'SELECT ' + lcFields + ' FROM ' + lcTable + ' ORDER BY ' + lcOrderField + ' INTO CURSOR ReportCursor HAVING !EMPTY(Fld1)'
>		&RunSQL
>		lnTotalCodes = _TALLY
>	ENDIF
>ENDIF
>IF EMPTY(ALIAS()) OR lnColumnCount <> 2
>    RELEASE lnTotalCodes
>    SELECT (THIS.CurrentAlias)
>    GOTO THIS.CurrentRecNo
>    RETURN .F.
>ENDIF
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform