Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using IIF in Select
Message
From
15/04/2005 00:19:54
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, United States
 
 
To
14/04/2005 23:30:09
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01004977
Message ID:
01004985
Views:
15
Thanks - works great!

>>SELECT invno, IIF(usesr2,salesrep2,'') FROM invpost
>>
>>The above select returns only the first character of the salesrep2 field. I think that is because the usesr2 is a Logical field. How can I return the full length of the salesrep2 field?
>>
>>Randy Wessels
>
>Within a SELECT statement, you should only use fixed-length expression, for example, iif(usesr2, salesrep2, space(10)) (assuming 10 is the length of the field), or padr(iif(usesr2, salesrep2, ''), 10)
>
>Otherwise, in your example, the first record that VFP encounters might very well be a record that does NOT fulfill the iif()-condition, so VFP decides that 1 character is enough to accomodate the result.
Previous
Reply
Map
View

Click here to load this message in the networking platform