Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select 'String is to long to fit' error message
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Select 'String is to long to fit' error message
Miscellaneous
Thread ID:
00820076
Message ID:
00820076
Views:
66
Hi All,

I'd like to use a multiple iif in a select statement but am getting a error message "String is too long to fit".

The below sample shows the syntax.

If I can get it to work, I will be adding a few more fields to the select, but I'm starting off with just this one field.

***************************************************
SELECT ;
IIF(rx <> " " and location = " ",trim(name) + " " + trim(detail) + " Rx- " + trim(rx), ;
IIF(rx <> " " and location <> " ",trim(name) + " (" + trim(location) + ") " + trim(detail) + " Rx- " + trim(rx), ;
IIF(rx = " " and location <> " ",trim(name) + " (" + trim(location) + ") " + trim(detail), ;
IIF(rx = " " and location = " ",trim(name) + " " + trim(detail),' ')))) as mdetail from hshealth
***************************************************

p.s.
I tried breaking it up storing sections to variables, but get the same error message.

Using variables:
mselone = " SELECT IIF(rx <> ' ' and location = ' ',trim(name) + ' ' + trim(detail) + ' Rx- ' + trim(rx), "
mseltwo = " IIF(rx <> ' ' and location <> ' ',trim(name) + ' (' + trim(location) + ') ' + trim(detail) + ' Rx- ' + trim(rx), "
mselthree = " IIF(rx = ' ' and location <> ' ',trim(name) + ' (' + trim(location) + ') ' + trim(detail), "
mselfour = " IIF(rx = ' ' and location = ' ',trim(name) + ' ' + trim(detail),' ')))) as mdetail from hshealth "

then:
&mselone + &mseltwo + &mselthree + &mselfour

Am I way off base trying to use this method?

Thanks,
Jim Harvey
Next
Reply
Map
View

Click here to load this message in the networking platform