C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Iff statement not working on certain fields in a query

rated by 0 users
This post has 1 Reply | 0 Followers

Not Ranked
Posts 9
eazyapps Posted: Thu, Sep 18 2008 3:38 PM

Hi,
I am setting the recordsource of my report through visual basic and rendering a report. I have a sql query built and my labels and text fields on my report all set up. If certain fields are blank, I don;t want to print the labels that go with them.
My query is something like this:

select firstName & ' ' & lastName AS patientName, address1, address2, physFirstName & ' ' & physLastName AS physName FROM patTable

Then I have labels on my report where the text is set to something like this:

iif(address1="","","Address #1")
iif(patientName="","","Patient Name")

All fields that are NOT concatenated fields work fine. If the value is empty, the label is blank, if it has a value, the label shows as expected. For all fields where the "AS" is used, the labels do not work properly.

Any thoughts would be appreciated.

-David

Not Ranked
Posts 9
eazyapps replied on Tue, Sep 23 2008 11:35 PM

Never mind. I'm such an idiot. Of course since I was concatenating the fields like that, the value was neither null nor "", but a single space. My check for a single space instead of a null value works just fine as expected. Hate it when the simplest things are overlooked.

 -David

Page 1 of 1 (2 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.