Do you mean put the semi-colon at the end of each line in the TEXT/ENDTEXT block? I tried that and it is not recognized as a line continuation character but was included in the resulting string.
>You can use ; and then you would not need to eliminate carriage returns, e.g.
>
>create cursor myName ;
>(field1 ..., ;
>field2 ... )
>
>
>>I need to create a cursor on the fly. The field names are known, but the lengths depend on the length of an equivalent field in a different table. In addition, I need to add a variable number of integer fields. I can do this easily enough by piecing together a string variable
>>CLOSE TABLES all
>>CLEAR
>>USE pop
>>
>>lcTry1 = "CREATE CURSOR output (F2 C(" + TRANSFORM(LEN(pop.f2)) +;
>> ", CITY C(" + TRANSFORM(LEN(pop.city))
>>FOR I = 1 TO 10
>> lcTry1 = lcTry1 + ",QTY" + TRANSFORM(I) + " int"
>>ENDFOR
>>lcTry1 = lcTry1 + ")"
>>EXESCRIPT(lcTry1)
>>
>>
>>(Almost) every time I see a post like this there is the suggestion to use TEXTMERGE as that makes the code more readable. I've rarely used this in the past and I can use some help getting it done properly. What I've come up with so far is
>>CLOSE TABLES all
>>CLEAR
>>USE pop
>>
>>TEXT TO lcTry2 NOSHOW TEXTMERGE
>>CREATE CURSOR output (
>> F2 C(<<LEN(pop.f2)>>),
>> CITY C(<<LEN(pop.city)>>)
>>ENDTEXT
>>FOR I = 1 TO 10
>> TEXT TO lcTry2 NOSHOW TEXTMERGE ADDITIVE
>> ,QTY<<I>> int
>> ENDTEXT
>>ENDFOR
>>
>>TEXT TO lcTry2 NOSHOW TEXTMERGE ADDITIVE
>> )
>>ENDTEXT
>>EXECSCRIPT(CHRTRAN(lcTry2,CHR(13)+CHR(10),""))
>>
>>I'm looking for some help in
>>
>>1. Making the code a little cleaner
>>2. Some parameter to TEXT which will eliminate the need to strip the CR/LF characters from the result
>>
>>Thanks to all........Rich