Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TEXT ..ENDTEXT question
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01536945
Message ID:
01536950
Views:
56
>>Hi,
>>
>>How can I make the TEXT..ENDTEXT to add or remove text based on some variable value. For example. Say I have this code:
>>
>>
>>TEXT TO cText NOSHOW
>>  INSERT INTO MYTABLE (FIELD1, FIELD2) VALUE (?MYTABLE.FIELD1, ?MYTABLE.FIELD2)
>>ENDTEXT
>>
>>
>>Now I want to add FIELD3 to the above expression but only if some variable lField3Exist is .T. How would I change the above expression? TIA.
>
>What about creating two separate cText
>
>IF lFieldExists
> text to ...
>
>ELSE
> text to


Alternatively, you can
text to lcText noshow textmerge

   insert into myTable (Field1, Field2 <<iif lFieldExists, ',field3','')>>) values ((?MYTABLE.FIELD1, ?MYTABLE.FIELD2 <<iif (lFieldExists, ',?MyTable.field3','')>>)

endtext
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform