Newbies chinablue Posted February 15, 2011 Newbies Posted February 15, 2011 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
Lee Smith Posted February 16, 2011 Posted February 16, 2011 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
Newbies chinablue Posted February 20, 2011 Author Newbies Posted February 20, 2011 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 1
Newbies chinablue Posted February 20, 2011 Author Newbies Posted February 20, 2011 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
comment Posted February 20, 2011 Posted February 20, 2011 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.
Newbies chinablue Posted February 21, 2011 Author Newbies Posted February 21, 2011 Thanks for your help. Does what I need.
Recommended Posts
This topic is 5024 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 accountSign in
Already have an account? Sign in here.
Sign In Now