Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help on concatenated address formula

Status
Not open for further replies.

Wahine

Technical User
Dec 13, 2002
3
US
i am trying to do two things -

first, i want to format an address bldg number to have no decimals, no comma separator,

then, i want a formula that will return only the street name if the bldg number field is empty, otherwise return the concatenated address.

this formula -

Local StringVar StNumber := CStr({WKWOWHYD.WHY_AD_BDG},0,"");
Local StringVar StName :={WKWOWHYD.WHY_AD_STR};

If (Len(StNumber)>0) then StNumber&" "&StName

Else If (Len(StNumber)<0) then StName

Else '';

says 'no errors found', but i get nothing if there is no bldg number. if there is one, i do get the concatenated address. where is my error?

i have tried numerous formulas and they give the same result even though they have 'no errors found'.

thanks, w.
 
first, i want to format an address bldg number to have no decimals, no comma separator,

Replace({table.bldg},&quot;.&quot;,&quot;&quot;)

then, i want a formula that will return only the street name if the bldg number field is empty, otherwise return the concatenated address.

If isnull({table.bldg}) or trim({table.bldg}) = &quot;&quot; then
{table.addr}
else
trim({table.addr})+&quot; &quot;+{table.bldg}

-k-
 
More succinctly:

If isnull({table.bldg}) or trim({table.bldg}) = &quot;&quot; then
{table.addr}
else
{table.addr}+&quot; &quot;+replace(replace({table.bldg},&quot;.&quot;,&quot;&quot;),&quot;,&quot;,&quot;&quot;)

Does it all at once.

This assumes that bldg is a string, which it should be.

-k
 
thank you for your help. the bldg number was not a string, so we ended up with this -

IF isnull({WKWOWHYD.WHY_AD_BDG}) then {WKWOWHYD.WHY_AD_STR}
else (Replace(Replace(CStr({WKWOWHYD.WHY_AD_BDG}),',',''),'.00','') & &quot; &quot; & {WKWOWHYD.WHY_AD_STR});

i didn't know about the replace command. thanks again, w.
 
There is a much easier way to get the building number as a string:

totext({table.building},&quot;#&quot;) will give you the building number with no punctuation or decimals.

Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top