August 20, 201510 yr 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 ))
August 20, 201510 yr 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!
August 20, 201510 yr 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.
August 24, 201510 yr Author 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.
August 24, 201510 yr 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 ) )
Create an account or sign in to comment