Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Condition in code text endtext
Message
From
12/06/2005 06:47:55
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01022574
Message ID:
01022578
Views:
9
>Hi all,
>
>How can i place a condition in code text endtext ?
>
>
> nOrdre = 1
>
>  TEXT TO lcSql NOSHOW TEXTMERGE
>  SELECT  LEFT( T.cnomteleph , 20 )  + ' - F.' + TRANSFORM( Ve.cnofact , "99999999" ) AS 'cName',;
>    Ve.iid;
>    FROM amline!cfiltre cf INNER JOIN amline!Vente Ve ON Ve.iid = cf.itelephoneid ;
>    INNER JOIN amline!Teleph T ON  Ve.itelephoneid = T.iid ;
>    INNER JOIN amline!Resident R ON  T.iid = R.itelephoneid ;
>    IF nOrdre= 1
>     ORDER BY 1 DESC INTO CURSOR cNames
>    ELSE
>     ORDER BY 1 INTO CURSOR cNames
>    ENDIF
>  ENDTEXT
>
>
>
>bernhart
SET TEXTMERGE ON NOSHOW  && YOU CAN LEAVE IT ON
nOrdre = 1
SET TEXTMERGE TO MEMVAR lcSql
\SELECT  LEFT( T.cnomteleph , 20 )  + ' - F.' + TRANSFORM( Ve.cnofact , "99999999" ) AS 'cName',;
\   Ve.iid;
\   FROM amline!cfiltre cf INNER JOIN amline!Vente Ve ON Ve.iid = cf.itelephoneid ;
\   INNER JOIN amline!Teleph T ON  Ve.itelephoneid = T.iid ;
\   INNER JOIN amline!Resident R ON  T.iid = R.itelephoneid ;
IF nOrdre= 1
\   ORDER BY 1 DESC INTO CURSOR cNames
ELSE
\   ORDER BY 1 INTO CURSOR cNames
ENDIF
SET TEXTMERGE TO  && this write the TEXTMERGE buffer into the variable
and this is 50/60% faster

But next is 120/150% faster
SET TEXTMERGE OFF NOSHOW
nOrdre = 1
SET TEXTMERGE TO MEMVAR lcSql
	\ SELECT  LEFT( T.cnomteleph , 20 )  + ' - F.' + TRANSFORM( Ve.cnofact , "99999999" ) AS 'cName',;
	\  Ve.iid;
	\   FROM amline!cfiltre cf INNER JOIN amline!Vente Ve ON Ve.iid = cf.itelephoneid ;
	\   INNER JOIN amline!Teleph T ON  Ve.itelephoneid = T.iid ;
	\   INNER JOIN amline!Resident R ON  T.iid = R.itelephoneid ;
	IF nOrdre= 1
	\   ORDER BY 1 DESC INTO CURSOR cNames
	ELSE
	\   ORDER BY 1 INTO CURSOR cNames
	ENDIF
SET TEXTMERGE TO
Previous
Reply
Map
View

Click here to load this message in the networking platform