Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

HOw would I do this?

If any word in "selected text" contain 1 letter then ignore

For example A & B CompanY or Company A & B or A company B

would return simply "Company"

Any help would be great

  • 3 weeks later...
Posted

You must loop through the entire text field word by word. Evaluate each word as you loop through and rebuild the "selected text" by evaluating the length of the word. If the length of the word = 1, do not add it to the rebuilt "selected text", else add the word to the rebuilt text.

You probably should use global fields to complete the evaluation. Keep in mind that text parsing is tedious and difficult. But it is one of the keys to becoming a professional.

Posted

You could create a calculation to do this, but it would have a word limit hard-coded into it.

It'd be something like

If ( Length (MiddleWords(textfield, 1, 1) = 1, "", MiddleWords(textfield, 1, 1) & " " ) &

If ( Length (MiddleWords(textfield, 1, 2) = 1, "", MiddleWords(textfield, 1, 2) & " " ) &

If ( Length (MiddleWords(textfield, 1, 3) = 1, "", MiddleWords(textfield, 1, 3) & " " ) &

If ( Length (MiddleWords(textfield, 1, 4) = 1, "", MiddleWords(textfield, 1, 4) & " " ) &

etc.

I may have got the syntax for the MiddleWords function wrong, check which parameter refers to the starting word and increment that for each iteration.

Posted

You could also use a repeating calculation a la

Case ( not Length (MiddleWords(Extend(textfield), index, 1)) = 1, MiddleWords(Extend(textfield), index, 1) )

then use a ValueListItems calculation to concatenate the results.

I mostly copied and pasted. Thanks for the corrections, Ugo. laugh.gif

I don't know about the odd characters. What happens if you set the index to ASCII?

Posted

Hi JT,

Yes, but wouldn't Extend( ) be used here too...Didn't tried the " " trick, but I don't get it.

And what should we don with " ' ", or "-" or other characters that sometimes should be considered as characters...

Posted

Hi Vaughan,

I tried your calculation, and did get some errors in the syntax. Here is a modification of your calculation that seems to work as expected.

If( Length(MiddleWords(textfield, 1, 1)) = 1, "", MiddleWords(textfield, 1, 1) & " " ) &

If( Length(MiddleWords(textfield, 2, 1)) = 1, "", MiddleWords(textfield, 2, 1) & " " ) &

If( Length(MiddleWords(textfield, 3, 1)) = 1, "", MiddleWords(textfield, 3, 1) & " " ) &

If( Length(MiddleWords(textfield, 4, 1)) = 1, "", MiddleWords(textfield, 4, 1) & " " )

as you can see, the starting point in the middlewords was reverse and it required a second ")" prior to the =1,

HTH

Lee yay.gif

Posted

Hi -Queue-,

Did I miss a memo? wink.gif

I'm really lost, and it sounds like I missed a post or something. If so could you point me to where this was discussed already, if not how about a little more explanation on this post.

What is the "index" Field?

What is the ValueListItems calculation

Is there a file explaining this that you used to copy and paste from?

Sorry for being a pest here, but I'm always looking at better ways to do these things, and I'm sure it will help others too.

Lee confused.gif

Posted

No problem, Lee. This is a method I post frequently, which is why I didn't feel the need to elaborate on it at the moment.

Index is a repeating field containing 1, 2, 3, etc.

A repeating calculation is used that only needs one line and is dynamic.

A value list is created based on the repeating calc.

The VLI calc is just the VLI calc with some substitutes added for easier viewing.

The only drawback is that a forced refresh is necessary, either a Go to Field pointing to the VLI field, a Go to Next/Previous, or an Enter Find Mode - Enter Browse Mode.

For calcs only a few lines long, it's probably more of a nuisance than typing out the redundant lines with only a couple of values changed. It can be much easier, not to mention more dynamic, however, than hardcoding a 20 plus line calc. Version 7 makes this even nicer by eliminating the need for a global index field for Index to lookup by using Get(CalculationRepetitionNumber), although it has a problem with related repetitions (though I hear this is to be fixed soon).

Attached is an example for the original question in this thread.

Vli.zip

Posted

Hi -Queue-,

Thanks for your sample file, and additional comments.

Now that I see it, I do remember you used this approach on something in the past. I guess I need to take your file apart and see what makes it tick.

Thanks again,

Lee confused.gif

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