Jump to content

Extracting Text


This topic is 6208 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi:

I have some data extracted from a web page, the data is paragraph delimited in a text field (much more than listed here)

I want to populate fields, for example: ItemName, StockNumber, EngineType, Status, Options by parsing the data.

I used middleValues function, and that was fine if all the items where in order. But some of the items are missing on some records.

Some sample data:

record 1

Item Name: Acme Engine

Stock Number: 00000000

Engine Type: 8

Status: Pending

Options: None

record 2

Item Name: Acme Engine

Engine Type: 8

Status: Pending

Options: None

record 3

Item Name: Acme Engine

Stock Number: 00000000

Engine Type: 8

Options: None

Case ( PatternCount ( text; "Status:") = 1; Position ( text ; "Status:" ; 1 ; 1 )+7)

That gives me the starting position for extracting the text for "Status:".

But how do I find the end position (paragraph mark at the end of line from starting position)

Link to comment
Share on other sites

Should have done a search of the forum using the word "Extract".

Here is a solution that I found from a post by Comment.

Case ( PatternCount ( text ; "Status: " ) ;

Let ( [

start = Position ( text ; "Status: " ; 1 ; 1 ) + 8 ;

end = Position ( text ; ¶ ; start ; 1 )

] ;

Middle ( text ; start ; end - start )

); "")

Link to comment
Share on other sites

Quite right Comment, the Let statement was yours, the Case statement with the redundant "" was my addition.

Link to Comment's post:

http://fmforums.com/forum/showtopic.php?tid/172999/post/189829/hl/extract/

Edited by Guest
Link to comment
Share on other sites

This topic is 6208 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.