sal88 Posted May 18, 2019 Posted May 18, 2019 Hi all Is there a calculation to remove all long text strings (say anything over 20 characters) from text fields? Thanks
sal88 Posted May 18, 2019 Author Posted May 18, 2019 The string(s) could appear anywhere within the field. I'm trying to clean up emails where there's lots of strings from hyperlinks that are in the signatures (usually from the email signature).
comment Posted May 18, 2019 Posted May 18, 2019 Then I am afraid I don't understand what you mean by "string". Wy don't you provide an example or two of what's in the field and what you would like to see as the result.
sal88 Posted May 18, 2019 Author Posted May 18, 2019 (edited) Emails are retrieved as records. And the body of the email might contain something like this: Click this link to unsubscribe from this email: https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmypcsecurity.webrootanywhere.com%2Funsubscribe.aspx%3FT%3Dasdffsdf34228e3b-77d9-4eb2-8132-778fd4dea454%26UEM%3Dsupport%40madso.uk&data=02%7C01%[email protected]%7Casd29c4c0901c808d673d792d0%7C7a80fada51274aa9aaedca692e314d1d%7C1%xxx68237670672dddata=0YhXOxZRHF6%2Fls6fY%2BA4za%2BvsGo6dPBtWMQhVQZo%2ByE%3D&reserved=0 It's these long strings of text that I would like to remove as they make reading emails difficult (especially when there are multiple emails contacenated). But there are so many different ones that I can only think to do a search by length, rather than a specific substitute calculation. Edited May 18, 2019 by sal88
comment Posted May 18, 2019 Posted May 18, 2019 This is not going to be simple, because Filemaker can divide text only to paragraphs (values) and words. In your example, the substring: https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmypcsecurity.webrootanywhere.com%2Funsubscribe.aspx%3FT%3Dasdffsdf34228e3b-77d9-4eb2-8132-778fd4dea454%26UEM%3Dsupport%40madso.uk&data=02%7C01%[email protected]%7Casd29c4c0901c808d673d792d0%7C7a80fada51274aa9aaedca692e314d1d%7C1%xxx68237670672dddata=0YhXOxZRHF6%2Fls6fY%2BA4za%2BvsGo6dPBtWMQhVQZo%2ByE%3D&reserved=0 is actually 32 separate words, the way Filemaker sees it. So you need to make up your own division - probably by looking for spaces and returns as the only separators to consider. And of course, this must be a recursive process, taking each "token" in turn and examining it for length. In the attached demo, I used a looping script (with 2 loops, one for paragraphs and one for tokens separated by spaces). To make this a calculation, you would need to replicate the same logic using a custom function (or functions). ShortenLongStrings.fmp12
OlgerDiekstra Posted May 19, 2019 Posted May 19, 2019 14 hours ago, sal88 said: Emails are retrieved as records. And the body of the email might contain something like this: Click this link to unsubscribe from this email: https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmypcsecurity.webrootanywhere.com%2Funsubscribe.aspx%3FT%3Dasdffsdf34228e3b-77d9-4eb2-8132-778fd4dea454%26UEM%3Dsupport%40madso.uk&data=02%7C01%[email protected]%7Casd29c4c0901c808d673d792d0%7C7a80fada51274aa9aaedca692e314d1d%7C1%xxx68237670672dddata=0YhXOxZRHF6%2Fls6fY%2BA4za%2BvsGo6dPBtWMQhVQZo%2ByE%3D&reserved=0 It's these long strings of text that I would like to remove as they make reading emails difficult (especially when there are multiple emails contacenated). But there are so many different ones that I can only think to do a search by length, rather than a specific substitute calculation. Maybe display these emails in a webviewer so that the html code gets displayed properly? I did a google on removing urls form emails and got a lot of responses that had negative results from this. Apparently not as easy to do as it has a tendency to break a lot in the emails.
sal88 Posted June 10, 2019 Author Posted June 10, 2019 Thanks guys! I'll be exploring both options. I guess the new While function will be handy for comment's trimming option too.
Recommended Posts
This topic is 2004 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