LaRetta Posted March 1, 2005 Posted March 1, 2005 Text calculations and I don't get along. I have a string which always looks like this: StaffID ProdID TypeID xxxx xxxxx YYYYMM The x's represent what I need to isolate and can be one to several words. The IDs vary in length and type but are always separated by a space and always only one word. I've tried: MiddleWords ( BottleKey; 4 ; LeftWords( BottleKey; WordCount(BottleKey) - 1 )) ... but that gives me xxxx xxxx YYYYMM I've tried: Right(BottleKey; Length(BottleKey) - Position(BottleKey; " "; 1; 3) ) ... which gives the exact same result. Bummer. I can't drop the YYYYMM off the end no matter what I try!! Can someone help me with the text calculation and (more importantly) HOW you approached this (from left, right or middle) so I can learn for the next text calculation I encounter. Thank you!!! LaRetta
-Queue- Posted March 1, 2005 Posted March 1, 2005 How about MiddleWords( BottleKey; 4; WordCount(BottleKey) - 4 ) ? Your first calc almost has it, but you only need to determine how many X words there are by subtracting 4 (for the StaffId, ProdId, TypeId, and YYYYMM).
LaRetta Posted March 1, 2005 Author Posted March 1, 2005 Oh yeah!!! Perfect, of course! JT, it always seems so simple when you do it!! I just spent 4 hours on this stinking puppy! I had reached a point of deciding to run two scripts ... one to end up with above result and again to split off the right YYYYMM. I wonder if anyone else ever has done something so silly to get the right text strip (as to run through the records twice)?? But I'm trying very hard not to write trash. Thank you for helping me keep my solution clean!! LaRetta
-Queue- Posted March 1, 2005 Posted March 1, 2005 My pleasure. I've done a lot of silly things. Then I found Scriptology and FMForums.
Recommended Posts
This topic is 7301 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