cancel
Showing results for 
Search instead for 
Did you mean: 

Help with formula please

Former Member
0 Kudos

I need an address to be printed on a form. The address can be in the form of address, city, state, zip or the address field can contain a location/site (example a room number or building name)

With the formula I have below, if the address is a room number or building name, it prints a comma after it.Exampe:Building#10,

How do I prevent the comma from printing?

I want it to show commas when the address has address, city, state, zip and no comma when it prints the room/building

IF NOT ({Use_Location.PERMIT_NO}LIKE"00-??-???" )

THEN '<font color = "blue">'&' '+'<b>'&"Equipment can be used only at:" & '</b> </font>' &'<font size ="+2">' & '<b>'& {@Use addr is blank} + {@Use city is blank} +{@Use state is blank} + {@Use zip is blank} & '</font>' & '</b>'

I created these formulas.

@Use addr is blank

IF Isnull ({Use_Location.USE_ADDRESS})

Then " "

Else {Use_Location.USE_ADDRESS} +’,’ + “ “

@Use city is blank

IF Isnull ({Use_Location.USE_CITY})

Then " "

Else {Use_Location.USE_CITY} +’,’ + “ “

@Use state is blank

IF Isnull IF Isnull ({Use_Location.USE_STATE})

Then " "

Else {Use_Location.USE_STATE} +’,’ + “ “

@Use zip is blank

IF Isnull ({Use_Location.USE_ZIP)

Then " "

Else {Use_Location.USE_ZIP}

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Gina,

1. Create a formula called @address with this code:

stringvar addr := {@Use addr is blank} + {@Use city is blank} +{@Use state is blank} + {@Use zip is blank};
if right(addr,2) = ", " then
addr := Left(addr, Len(addr)-2)
else addr;

2. Modify the existing formula as:

IF NOT ({Use_Location.PERMIT_NO}LIKE"00-??-???" ) THEN 
'<font color = "blue">'&' '+'<b>'&"Equipment can be used only at:" & '</b> </font>' &'<font size ="+2">' & '<b>'& {@address} & '</font>' & '</b>'

-Abhilash

Former Member
0 Kudos

Thank you very much for your help.

Answers (0)