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

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

Recommended Posts

Posted

Any ideas how to solve this problem? I have a field with a page of text. What i would like to get is a script that searches for a specific word (Cast&Crew) and copys the text between the specific word (Cast&Crew) and a second word that follows sometime after in the text. The in between text then will be entered into the field.

Any ideas??

Thanks!

Posted

Hi tmas73,

and a second word that follows sometime after in the text.

Well, we have the start of our search (Cast&Crew). But you haven't given us an end. frown.gif If you can tell us how to determine where the end is, we can grab everything inbetween and insert it in a field for you via script. smile.gif

Cheers,

LaRetta

Posted

The 2 word is (Runtime:) So the idea is to get the text between Cast&Crew and Runtime: and place it into a field..

Thanks La Retta

Posted

LeftWords( Middle( textfield, Position( cast, "(Cast&Crew)", 1, 1 ) + 11, Position( textfield, "(Runtime:)", 1, 1 ) - Position( textfield, "(Cast&Crew)", 1, 1 ) - 11 ), 9999 )

Posted

Thank you very much!! I go it to work.

I have one more question.

I only have (Cast&Crew) and i want following few letters or words after cast&crew??

Thanks for your time!

Posted

Hello tmas73,

Middle(TextField, Position(TextField, "Cast&Crew", 1, 1 ) + 11, 3)

will give you the first three letters following 'Cast&Crew', and

LeftWords(Middle(TextField, Position(TextField, "Cast&Crew", 1, 1 ) + 11, 9999), 3)

will give you the first three *words* following 'Cast&Crew'. cool.gif

Posted

Thanks Ray worked out fine. i just wonder if it is possible to include a logical function like for example:

Go to Cast&Crews on the page and looks for a word after "CastandCrew". Like the Cast&Crew is a starting point for a second search.

Search for "Cast&Crew" -> search from point "Cast&Crew" and look for "USA:R"

I'm sorry for my "beginners brain" but I really have problems with those search word logic.

Thank you!!

Posted

The following expression:

Case(Position(TextField, "USA:R", Position(TextField, "Cast&Crew", 1, 1 ), 1 ), "Yes", "No")

...will return 'yes' if the text 'USA:R' occurs in TextField after the first occurrence of 'Cast&Crew'. And in fact:

Position(TextField, "USA:R", Position(TextField, "Cast&Crew", 1, 1 )

will give you the character number where USA:R starts. wink.gif

Posted

Thanks again ray but this time I had no luck!! this is the script i use!!

Left(Middle(myText, Position(myText, "USA:", Position(myText, "Certification:", 1, 1), 1) 4, 9999), 5)

It works fine with "USA:R" but if there is "USA:PG-13" it will cut off 4 letters to the right. I also cant display 4 to the right because after "PG13 or R" there follows a "/" and some other text. So it would display "R /.." Is there a solution where I have as start point "USA:" and to the right the "/".

My field of interest is only the rating for the USA so I'm trying to filter it out from a page of text.

Like (Must find Certification subcategory USA: !!!!

"Certification: Australia:M /Finland:K-16 /France:-12 /Norway:16 /Sweden:15 /UK:15 /USA:R /West Germany:16"

I hope this all makes sense!!

Thomas

Posted

Try this:

Middle(MyText, Position(MyText, "USA:", Position(MyText, "Certification:", 1, 1), 1),

Position(MyText, "/",Position(MyText, "USA:", Position(MyText, "Certification:", 1, 1), 1), 1) - Position(MyText, "USA:", Position(MyText, "Certification:", 1, 1), 1))

Posted

Try this one....

Middle(text,Position(text, "USA:R", Position(text, "Certification:", 1, 1 ),1),Position(text, "/", Position(text, "USA:R", Position(text, "Certification:", 1, 1 ),1), 1) - Position(text, "USA:R", Position(text, "Certification:", 1, 1 ),1))

or a little smaller

Middle(text,Position(text, "USA:R", Position(text, "Certification:", 1, 1 ),1),

Position(Right(text, Length(text) - Position(text, "USA:R", Position(text, "Certification:", 1, 1 ),1)), "/", 1, 1))

Posted

Hi Ugo,

Your second calc my be a little shorter, but you will find that it will fail if there is a '/' between 'Certification' and 'USA:'.

Once you correct for this you'll then find that it is then longer than the previous version. wink.gif

Posted

Woooww guys, I am amazed!! I have no idea how you can get to this result!!

IT WORKS all 3 versions. The only small change would be:

The result I get is "USA:PG-13" what do i have to do to get rid of "USA:".

Deeply grateful! =)

Thomas

Posted

The simplest way is probably:

Middle(MyText, Position(MyText, "USA:", Position(MyText, "Certification:", 1, 1), 1) + 4,

Position(MyText, "/",Position(MyText, "USA:", Position(MyText, "Certification:", 1, 1), 1), 1) - Position(MyText, "USA:", Position(MyText, "Certification:", 1, 1), 1) - 4)

Posted

Well,

Assuming :

- your goal is to parse a given string within a looping script.

- It's not given for sure that this string exists in that record

- That in this later case, you want the result to be "Empty"

- You want to remove the hyphen also.

You may try the following Long calculation, involving 2 global fields for FirstString and SecondString.

Choose(not Position(TextField&"/",SecondString, Position(TextField&"/", FirstString, 1, 1 ), 1 ),

Trim(Substitute(Middle(TextField&"/",Position(TextField&"/", SecondString, Position(TextField&"/", FirstString, 1,1 ),1),Position(TextField&"/", "/", Position(TextField&"/" ,SecondString,Position(TextField&"/", FirstString, 1, 1 ),1), 1) - Position(TextField&"/",SecondString, Position(TextField&"/", FirstString, 1, 1 ),1)),SecondString& ":","")),"Empty")

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