Skip to Content
0

Help with formula please

May 02, 2017 at 06:52 PM

39

avatar image
Former Member

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}

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Abhilash Kumar
May 03, 2017 at 07:54 AM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you very much for your help.

0