Jump to content

Remove long strings


This topic is 1775 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi all

Is there a calculation to remove all long text strings (say anything over 20 characters) from text fields?

Thanks

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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 by sal88
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...

Thanks guys! I'll be exploring both options. I guess the new While function will be handy for comment's trimming option too.

Link to comment
Share on other sites

This topic is 1775 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.