{SOLVED}Define that shows information between two commas...
I want to have a column where the JUST the information between two commas is displayed. The problem, there is no set number of characters between the commas.
Sample of the information: TUBES,SA209T1,2.750X282 TUBES,SA209T1A,1.1250X260 TUBES,SA213TP304H,1.750X300
Thanks!This message has been edited. Last edited by: Pops,
Release: WebFOCUS 8 Windows HTML, PDF, EXCEL
April 16, 2015, 05:33 AM
Twanette
Hi,
The GETTOK function should do just this for you.
WebFOCUS 8.2.06 mostly Windows Server
April 17, 2015, 08:24 AM
Pops
quote:
GETTOK
Thank you, I'm still learning and I have never seen this one...
Can you give me an idea of the input for this?
For GETTOK I see (infield, inlength, token#, 'delim', outlength, outfield)
My infield is ITEM_DESC and I'm guessing the 'delim' would be the , (here is a sample of the description TUBES,SA192,4.000X150 and TUBES,SA210A1,0.875X148)
Release: WebFOCUS 8 Windows HTML, PDF, EXCEL
April 17, 2015, 10:46 AM
Darryl_uk
Here is something I have used in webfocus (not infoassist) that may be of interest. A bit clunky perhaps...
My data field is called GNRL and has no comma at the start just at the end of the data I want. If you have a comma in position 1 then easy enough to get rid off with edit. Else you will need to find it and remove it too.
-*FIND POSITION OF COMMA PSTART01/I4 = POSITV(GNRL,LENV(GNRL,'I4'), ',', 1,'I4'); -*FIND LENGTH OF SECTION BEFORE COMMA PLEN01/I4=IF PSTART01 EQ 0 THEN 0 ELSE PSTART01 -1 ; -*EXTRACT THE SECTION PATTERN01/A100V= SUBSTV(500, GNRL, 1, PLEN01, PATTERN01);
7.7.05 Windows.
April 18, 2015, 06:57 AM
Twanette
Hi,
OK, so if you have these values in your ITEM_DESC field: TUBES,SA192,4.000X150 TUBES,SA210A1,0.875X148
And working on the assumption that ITEM_DESC is e.g. an A100 format And you want SA192 and SA210A1 in a field, then GETTOK would work like this:
DEFINE FILE yourfile NEW_FIELD/A50 = GETTOK(ITEM_DESC, 100, 2, ',', 50, 'A50') ; END TABLE FILE yourfile PRINT ITEM_DESC NEW_FIELD END
In the above example I've specified that I want the second token i.e. I specified 2 for token#. You should try the DEFINE with a 1 and a 3 and a -1 as well, just to see what the effect is.