Jump to content

Need help with a calculation to extract text.


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

Recommended Posts

For example, say I have a field with the following text.

The quick brown fox jumped over the red dog.

I need to parse the information in this field into complete words and into 4 separate fields which are not longer than 12 characters.

So the result would be:

Field1 = The quick (9 characters)

Field2 = brown fox (9 characters)

Field3 = jumped over (11 characters)

Field4 = the red dog. (12 characters)

I need assistance with the calculations that I would need for each of the fields to extract this info.

The total length of the text will never exceed 48 characters but could be as short as 15 characters.

The reason for doing this is that I'm trying to export this information to another database that uses multivalues to display long text. The field length on

the other database doesn't allow for the length to be greater than 12 characters.

Any assistance would be greatly appreciated.

Link to comment
Share on other sites

You're correct. I would need the calculations to work for any length words and any length of text not to exceed 48 characters.

So if the text field contained:

I should have been more specific

field1 = I should (8 characters)

field2 = have been (9 characters)

field3 = more (4 characters)

field4 = specific (8 characters)

Link to comment
Share on other sites

You're correct. I would need the calculations to work for any length words and any length of text not to exceed 48 characters.

I'm not sure what I'm correct about. I was asking what the rule should be for cases where the words don't fit the max 12 chars per grouping. It's still important. Do they get cropped or does the grouping wind up with more than 12 chars? The example:

"The quick brown fox jumped over the lazy dog."

does not fit:

Field1 = The quick (9 characters)

Field2 = brown fox (9 characters)

Field3 = jumped over (11 characters)

Field4 = the lazy dog. (13 characters)

Link to comment
Share on other sites

Given your example, the grouping would need to be cropped.

Actually, the character length of 12 is not really the limitation. I was just using it to try to simplify things. The limitation is 120 characters so I don't think there is a word in the English language that has more than 120 characters. I was just trying to see how the calculations for the fields might be written and then expand them from 12 to 120 characters.

Link to comment
Share on other sites

Okay, let's start again.

If you want to break a string into substrings where the max length is 120 characters, what's desired: that the strings be balanced in length, or that they fill in from the first substring down. For example: if the string is only 200 characters, do you want to have as many words possible filling the first substring, then the remainder going to the second, or do you want the four substrings balanced as much as possible? Can only the last substring be cropped, or could cropping occur in any of the substrings?

Link to comment
Share on other sites

IIUC, the input is text and 4 length limits.

The output is 4 strings, each containing whole words only, and not exceeding its corresponding length limit.

Properly this should be a recursive calculation, but since poster's profile doesn't indicate an Advanced version, and since it's only 4 fields, I believe it could be hard-coded.

WordWrap4.fp7.zip

Edited by Guest
Removed List() function from the demo
Link to comment
Share on other sites

This topic is 6215 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.