Jump to content

Extracting text


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

Recommended Posts

  • Newbies

Hi,

I get orders from a well known online retailer by email notification. I can cut and paste the full details into a text field in FMP 11, but how do I search this field to extract and order number or a Stock Keeping Unit (SKU) number?

I want a script to read the field, find the text "Ord No.xxxxx" and then place it into my dedicated order number field in the table.

So searching the field would find: Ord no.123456

Then place 123456 into an order number field.

Thanks in advance

Chinablue

Link to comment
Share on other sites

This need comes up from time. There are pleanty past post about how this can be approached. Read about Left, LeftWords, Right, Rightwords, MiddleWords, etc. Functions, do a search for keywords in this Forum, using Parse, Parsing Text, Extract, Extracting, such as +parse +Text or +Extract +text. This search engine is the Gear Icon next to the quick find, under your icon.

You could also run this through a text editor using Grep Patters of Regular Expression.

Post a clone of your file, an actual example of the text or site, so we can see what you are talking about.

Lee

Link to comment
Share on other sites

  • Newbies

This need comes up from time. There are pleanty past post about how this can be approached. Read about Left, LeftWords, Right, Rightwords, MiddleWords, etc. Functions, do a search for keywords in this Forum, using Parse, Parsing Text, Extract, Extracting, such as +parse +Text or +Extract +text. This search engine is the Gear Icon next to the quick find, under your icon.

You could also run this through a text editor using Grep Patters of Regular Expression.

Post a clone of your file, an actual example of the text or site, so we can see what you are talking about.

Lee

  • Like 1
Link to comment
Share on other sites

  • Newbies

Thanks Lee,

I have managed to extract the order number from the text field.

Feels like a bit of a hack, but it works if the line always starts with the same characters, eg "Order No."

How does FM recognise a carriage return at the end of a line of text. I have had to use a blank space

at the end of the data.

Is there any way to move from line to line extracting the data?

I Would like to extract a "name", "address", "County/State", "zip" etc.

I've tried to attached a copy of a file but the upload is not permitted.

Below is the sample text and the calculation that does the extraction.

Dispatch to:

MR J STEED

BROADMOSS

BRUCEFIELD RD.

PERTHSHIRE

PH11 6LB

United Kingdom

Order ID: 202-9739057-1767548

Thank you for buying from Milly's Menu Shop

Calc

Let ( [

start = Position ( simple::contents ; "Order ID: " ; 1 ; 1 ) + Length ( "Order ID: " ) ;

end = Position ( simple::contents ; " " ; start ; 1 )

] ;

Middle ( simple::contents ; start ; end - start )

)

Any help extracting data line by line would be a great help,

Thanks

Chinablue

Link to comment
Share on other sites

I Would like to extract a "name", "address", "County/State", "zip"

If these elements are always present and in the same order, you can use the GetValue() function to extract them.

How does FM recognise a carriage return at the end of a line of text.

Use the ¶ operator.

Link to comment
Share on other sites

This topic is 4368 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
 Share

×
×
  • Create New...

Important Information

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