Page 1 of 1

Having trouble with functions

Posted: Wed Dec 12, 2007 10:41 pm
by John Dykema
I haven't done much fancy stuff in custom reports so I'm seeking help.
I'm trying to print address1, address2, city+state+zip. If address2 is not empty, I want to add ", " to the end of address1, then print address2. And always printing a ", " + city-state-zip, all on the same line.

I'm pulling my hair out on this function:
ALLTRIM(Qmf_temp.address)+IIF(NOTEMPTY(Qmf_temp.address2),", "+ALLTRIM(Qmf_temp.address2),)+", " Qmf_temp.city_zip

I'm getting missing commas, and missing ), and/or syntax errors... grrrrr
If you know functions, would you please give me a hand here? Thanks.

Posted: Thu Dec 13, 2007 8:55 am
by Jeff
John,

Try this expression:

Code: Select all

IIF(EMPTY(address), "", ALLTRIM(address)+", " ) + IIF(EMPTY(address2), "", ALLTRIM(address2) + ", ") + city_zip
NOTEMPTY is not a function, you could use "NOT EMPTY" OR "! EMPTY" or do what I did above and just return an empty string if the field is empty.

Posted: Fri Dec 14, 2007 11:01 pm
by John Dykema
Thanks, Jeff. That worked great. I think I'm catching on to object programming :shock:
1. I'm following the Cust reports Tutorial, pge 80 and it shows all the fields, as I would expect. But, my edit only shows fields from lastname through address2. None of the other fields show up. They are all in my "Edit output fields" in the Query. What gives?

2. Also, I want to print our names as follows: JACKSON, Dave & Mary
I use the expression as shown in the Tutorial as: (I did add the UPPER function, myself)
UPPER(ALLTRIM(Qmf_temp.lastname_a))+', '+ Qmf_temp.salut
I set the bold by clicking the Style tab in the expression windows. But I don't want the Salutation bolded. I tried setting up a variable but there's no Style tab in the variable window.
How do I unbold the Salutation. Any advice?