|
-
August 25th, 2009, 08:32 AM
#1
Extracting parts of a string
I have a string like the following...
00009 / Ivory / 3-5
00009 is the style
Ivory is the color
3-5 is the size
I need to create a Color and a Size formula. I can easily get the style by LEFT({icitem.desc},5) BUT...
How would I get the color? The size? How would I create a formula that would use the "/" as the delimiter and extract after it?
As always, any help here is GREATLY appreciated!
-
August 25th, 2009, 12:11 PM
#2
Re: Extracting parts of a string
You should be able to use Split({icitem.desc}, "/")[2] to get the color and Split({icitem.desc}, "/")[3] to get the size.
-
August 25th, 2009, 01:19 PM
#3
Re: Extracting parts of a string
I get the following error now:
"A subscript must be between 1 and the size of the array"
Any ideas?
-
August 25th, 2009, 01:32 PM
#4
Re: Extracting parts of a string
Do you have some records that don't have all 3 elements in the string?
You may be able to try the following for color...
Code:
//if Count (Split("00009 / Ivory / 3-5", "/")) >=2 then Split("00009 / Ivory / 3-5", "/")[2] else "Undefined"
if Count (Split({icitem.desc}, "/")) >=2 then Split({icitem.desc}, "/")[2] else "Undefined"
and this for size...
Code:
//if Count (Split("00009 / Ivory / 3-5", "/")) >=3 then Split("00009 / Ivory / 3-5", "/")[3] else "Undefined"
if Count (Split({icitem.desc}, "/")) >=3 then Split({icitem.desc}, "/")[3] else "Undefined"
Hope this helps
-Ranthalion
-
August 25th, 2009, 08:04 PM
#5
Re: Extracting parts of a string
Mid({icitem.desc}, Instr({icitem.desc}, ' / ') + 3,InStr({icitem.desc}, ' / ') - InStrRev({icitem.desc}, ' / ') - 2)
Would that work?
-
August 25th, 2009, 08:13 PM
#6
Re: Extracting parts of a string
The split function returns an array, not an element of the array.
Try
Code:
StringVar array x
x:=Split({icitem.desc}, ' / ')
x(1) is the Style
x(2) is the color
x(3) is the size
I believe this should work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|