Previous Thread
Next Thread
Print Thread
#43993 12/30/14 09:58 AM
Joined: Oct 2010
Posts: 28
V
V Offline
Joined: Oct 2010
Posts: 28
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.

Joined: Mar 2002
Posts: 4,571
Adagio God
Adagio God
Joined: Mar 2002
Posts: 4,571
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

Joined: Oct 2010
Posts: 28
V
V Offline
Joined: Oct 2010
Posts: 28
thank you, that's exactly what I needed.

Joined: Mar 1999
Posts: 10,504
Adagio Master
Adagio Master
Joined: Mar 1999
Posts: 10,504
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

Moderated by  Softrak Support 

Link Copied to Clipboard
Who's Online Now
0 members (), 71 guests, and 3 robots.
Key: Admin, Global Mod, Mod
Forum Statistics
Forums5
Topics14,679
Posts71,625
Members1,874
Most Online1,408
Dec 9th, 2025
November
S M T W T F S
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
Powered by UBB.threads™ PHP Forum Software 8.0.0