rbrouwer Posted January 26, 2007 Posted January 26, 2007 I have a text field which contains a code that is in the format of M followed by 5 numbers, which varies in position in the field and the actual numbers vary as well eg. M80410, M60234 etc. I want to make a calculation that extracts just that code from the rest of the text in that field. I tried using: Middle(text field;Position(text field;"M#####";1;1);6) Trying PatternCount (text field;"M#####") failed as well. I then realised that the the wildcard # for numbers (and wildcards in general) didn't work in calculations. I can't figure out how to tell the middle function to look for an M followed by 5 numbers in the text field. Thanks for any advice.
mr_vodka Posted January 26, 2007 Posted January 26, 2007 (edited) Maybe you could do something like this. Let ( [ f= field; x= Substitute ( field ; [0;"^"]; [1;"^"]; [2;"^"]; [3;"^"]; [4;"^"]; [5;"^"]; [6;"^"]; [7;"^"]; [8;"^"]; [9;"^"] ); p= Position ( x; "M^^^^^"; 1; 1 ) ]; Case ( p; Middle ( f; p; 6 ) ) ) Edited January 26, 2007 by Guest Added Empty check
rbrouwer Posted January 26, 2007 Author Posted January 26, 2007 Brillant ! So make a variable with every number in the field I need to parse from a "^" so then I can have a search string that works ! Thanks very much, works a treat.
Recommended Posts
This topic is 6572 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