• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Parsing of field

New Here ,
Sep 05, 2008 Sep 05, 2008

Copy link to clipboard

Copied

I am trying to parse a field, I cannot use right or left because the item isn't in the same place. Here is an example of the field data;

'MEISTER 56767 CB5-325-3-M-84-55 IGE 60DEG 6.5MMX14/M4.5 (G-213 MOD); FSP100:034250006500001; FSP200:RSRV-189'

I need to get FSP100:034250006500001 from the field.

Any ideas.
TOPICS
Advanced techniques

Views

537

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 05, 2008 Sep 05, 2008

Copy link to clipboard

Copied

Your specific example is a list with semi-colons as the delimiter.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 05, 2008 Sep 05, 2008

Copy link to clipboard

Copied

Yes it is, so how do I parse the field to parse within cf to see the semi-colons

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 05, 2008 Sep 05, 2008

Copy link to clipboard

Copied

rjproctor wrote:
> Yes it is, so how do I parse the field to parse within cf to see the semi-colons

If one where to read some of the ColdFusion documentation concerning
it's list functions, one would learn that all the list functions allows
one to specify the list delimiting charatcer(s) as a parameter of the
function.

I.E. <cfoutput>#listLen('MEISTER 56767 CB5-325-3-M-84-55 IGE 60DEG
6.5MMX14/M4.5 (G-213 MOD);FSP100:034250006500001; FSP200:RSRV-189',';')

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 05, 2008 Sep 05, 2008

Copy link to clipboard

Copied

OK, the listlen will give me the no of semicolons, but there are multiple semicolons and the item that I need isn't always after the 3rd semicolon but it is always after the FSP100:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 05, 2008 Sep 05, 2008

Copy link to clipboard

Copied

See the attached.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 05, 2008 Sep 05, 2008

Copy link to clipboard

Copied

quote:

Originally posted by: rjproctor
OK, the listlen will give me the no of semicolons, but there are multiple semicolons and the item that I need isn't always after the 3rd semicolon but it is always after the FSP100:


This might be the simplest way:
Use find to get the postition of FSP100:
Use RemoveChars to make FSP100: the first characters of your string
Use ListFirst to get the final answer.

Usage of all 3 functions are in the cfml reference manual. If you don't have one, the internet does.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 05, 2008 Sep 05, 2008

Copy link to clipboard

Copied

rjproctor wrote:
> OK, the listlen will give me the no of semicolons, but there are multiple semicolons and the item that I need isn't always after the 3rd semicolon but it is always after the FSP100:

Then you are looking for a regular expression search using the ReFind()
function. A read of the documentation for ReFind() and how to use the
resulting structure maybe in order.

<cfdump var="#refind('FSP100:(.*?);','MEISTER 56767 CB5-325-3-M-84-55
IGE 60DEG 6.5MMX14/M4.5 (G-213 MOD); FSP100:034250006500001;
FSP200:RSRV-189',1,true)#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 06, 2008 Sep 06, 2008

Copy link to clipboard

Copied

LATEST
Davidsimms has effectively wriiten the code for you. Oh, and don't double-post.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation