Topic Options
#43993 - 12/30/14 03:58 AM Gridview-Ship Address
VickieC Offline


Registered: 10/26/10
Posts: 28
Loc: Ontario
We enter in OE Ship to Address 3 the City and State separated by a comma. Is it possible to split this info into two columns in Gridview?
thanks.

Top
#43994 - 12/30/14 04:49 AM Re: Gridview-Ship Address [Re: VickieC]
Steve Schwartz Offline
Adagio God

Registered: 03/10/02
Posts: 4446
Loc: Wynnewood, PA
Yes, create Calculated Columns, one for the city and one for the state. There are two approaches, one easy, one trickier.

The easy one - if the format is always City, ST where the state is a two letter abbreviation, then use Right({Address3}, 2) to grab the state and Left({Address3}, length({Address3} - 4)) to grab the city.

If the format is not always City, ST then I will explain the other approach.

Steve

Top
#43995 - 12/30/14 05:38 AM Re: Gridview-Ship Address [Re: Steve Schwartz]
VickieC Offline


Registered: 10/26/10
Posts: 28
Loc: Ontario
thank you, that's exactly what I needed.

Top
#43998 - 12/30/14 08:01 AM Re: Gridview-Ship Address [Re: VickieC]
Retired_Guy Offline
Adagio Master

Registered: 03/16/99
Posts: 10493
Loc: Canada
Hi Vickie,

Here is the more complicated approach, which is a little bit better behaved if the address is not correctly formatted:
Code:
[City]
IF((FIND(",",{Ship Address 3} ,1))<>0,TRIM(LEFT({Ship Address 3} ,(FIND(",",{Ship Address 3} ,1))-1)),TRIM({Ship Address 3}))

[State]
IF((FIND(",",{Ship Address 3} ,1))<>0,TRIM(MID({Ship Address 3},(FIND(",",{Ship Address 3} ,1))+1,99)),"")


You can copy and paste this into a text file and import them if you want.

If the field does not contain a comma, then the whole field will be placed in the CITY calculated column.
_________________________
Andrew Bates

Top


Moderator:  Christa_Meissner 
Who's Online
1 registered (Bruce Gardner), 38 Guests and 1 Spider online.
Key: Admin, Global Mod, Mod
Forum Stats
1848 Members
5 Forums
14242 Topics
69746 Posts

Max Online: 359 @ 11/18/19 09:08 PM
May
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31