Matthew R White Posted August 20, 2015 Share Posted August 20, 2015 I'm currently using the following code below to text parse a field in my database. It has worked GREAT however I've come to the end of the text and I'm not sure how to say: Pull all text after the Prefix and don't stop at the suffix because there is no suffix. Any Ideas? Let ( [Textfield = BWIA2 FMP11 2::Web Quote Entry ;prefix = "Comments / other pilots / Explain Losses:" ;suffix = "Bill White Insurance" ;start = Position ( Textfield ; prefix ; 1 ; 1 ) + Length ( prefix ) ;end = Position ( Textfield ; suffix ; start ; 1 )] ;Middle ( Textfield ; start ; end - start )) Link to comment Share on other sites More sharing options...
dwdata Posted August 20, 2015 Share Posted August 20, 2015 Play around with this calculation: Let ( [Textfield1 = "Comments / other pilots / Explain Losses: this is the text I am after so be cool Bill White Insurance" ;Textfield2 = "Comments / other pilots / Explain Losses: this is the text I am after so be cool" ;Textfield3 = "this is the text I am after so be cool Bill White Insurance" ;prefix = "Comments / other pilots / Explain Losses:" ;suffix = "Bill White Insurance" ] ; Trim(Substitute(Textfield1;[prefix, ""];[suffix, ""])) & "¶¶" & Trim(Substitute(Textfield2;[prefix, ""];[suffix, ""])) & "¶¶" & Trim(Substitute(Textfield3;[prefix, ""];[suffix, ""])) )Obviously, replace your field with my test string. Hope this helps! Link to comment Share on other sites More sharing options...
comment Posted August 20, 2015 Share Posted August 20, 2015 I'm not sure how to say: Pull all text after the Prefix and don't stop at the suffix because there is no suffix. Your question can be read in two ways: (a) extract all text after the prefix; OR (b) if there is a suffix, extract the text between the prefix and the suffix; otherwise extract all text after the prefix. 1 Link to comment Share on other sites More sharing options...
Matthew R White Posted August 24, 2015 Author Share Posted August 24, 2015 Thanks dwdata, how do I put this to obtain the data from textfield web quote entry? Thanks Comment, the answer would be A. Extract all text after the prefix. Link to comment Share on other sites More sharing options...
comment Posted August 24, 2015 Share Posted August 24, 2015 the answer would be A. Extract all text after the prefix. That's good, because that's the easy one: Let ( [ prefix = "your prefix here" ; start = Position ( Textfield ; prefix ; 1 ; 1 ) + Length ( prefix ) ] ; Right ( Textfield ; Length ( Textfield ) - start + 1 ) ) Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 3309 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