Provide an actual example of what's in the field for a couple of records.
As for the text you want, after the known block of text, do you want ALL of the remaining text? Or all of the text up to some other point?
As for a formula, I'd probably use a Let statement because it'll be easier to see what you're doing.
KnownText = "Example: " ;
FieldToUse = TableName::FieldName
LengthOfField = Length ( FieldToUse ) ;
LengthOfKnownText = Length ( KnownText ) ;
EndOfKnownText = Position ( FieldToUse ; KnownText ; 1 ; 1 ) + LengthOfKnownText - 1
Right ( FieldToUse ; LengthOfField - EndOfKnownText )
alright, so basically this has to do with emailing. I have a plugin that retrieves mail (mailit) and I wanted to set up something that picks up when messages return. There's a sample message below,
I've censored any sensitive material (with [ ]), this is to be used to send information to our customers about their account and on rare occasion the email provided is not accurate. My intention is to grab the information in To: [Recipient] and then place a note on their account that the message returned so that when they come in we can update their contact information.
Because this is sent over SMTP, the return message looks slightly different for some @domain.com email addresses, so would prefer not to have it look on the, in this case, 5th line. Sample Message:
Message could not be delivered
From: [My email]
Date: Tue, 29 Mar 2016 16:32:51 +0000
Not sure if this is what you want, but you can try:
Let ( [
identifier = "To: " ;
len = Length ( identifier ) ;
pos = Position ( yourMailBlock ; identifier ; 1 ; 1 ) ;
retCount = ValueCount ( Left ( yourMailBlock ; pos ) ) ;
theLine = GetValue ( yourMailBlock ; retCount )
Middle ( theLine ; len +1 ; Length ( theLine ) - len )
Gotcha. So you are trying to isolate what's in "[Recipient]", then you'd use that to find the appropriate customer in your database and do something? And if your database didn't have a customer whose email matched with what you had, you'd do something else?
FieldToUse = TableName::FieldName ;
ToText = "To: " ;
ToText_Length = Length ( ToText ) ;
StartOf_ToText = Position ( FieldToUse ; ToText ; 1 ; 1 ) ;
EndOfToText = Position ( FieldToUse ; ToText ; 1 ; 1 ) + ToText_Length ;
SubjectText = "Subject: " ;
StartOf_SubjectText = Position ( FieldToUse ; SubjectText ; 1 ; 1 ) ;
Trim ( Middle ( FieldToUse ; StartOf_ToText + ToText_Length ; StartOf_SubjectText - EndOfToText - 1 ) )
Sorry for the delayed reply, had pressing matters to resolve before I could use your proposed solution. It worked like a charm! Thanks for your help!
MINOR NOTE: I did have to remove the " " from "To: " for it to work