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

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

Recommended Posts

Posted (edited)

Hi I want to find how many times a word appears in long text fields.

Is there a way to create a script which will also return the result to a HOWMAY number field?

I think I should create values, but as I want to do a loop the values should change in each turn of the loop copying the actual value from a field. I tried but I am not really able to do so as I can't make it work

Thanks a lot

Edited by Guest
Posted

Hi

1) Create these fields:

YourLongTextField

Word to Find

Result

2) Create this script:

Freeze Window

Set Variable [ $LongText ; Value: YourTable::YourLongTextField ]

Go to Field [ YourTable::YourLongTextField ]

Perform Find/Replace [ No dialog ; YourTable::Word to Find ; "§§§" ; Replace All [color:red]( Direction: All ; Match whole words only ; Search across: Current record ; Search within: Current field ) ]

Set Field [ YouTable::Result ; PatternCount ( YourTable::YourLongTextField ; "§§§" ) ]

Set Field [ YourTable::YourLongTextField ; $LongText ]

Commit Records/Requests [ ]

3) Put some long text into the "YourLongTextField"

4) Put the word to search into the field "Word to Find"

5) Fire the script above by menu ( or by a button or by a trigger OnObjectExit of the "Word to Find" field )

Note that the script above will search for the word w/o pay attenction to its case, but can be modified to also match case.

Posted

Why do you want to loop the values? A global text to hold the word to find (called gFind) and a calculation with: PatternCount ( textField ; gFind ) will give you a count. Could you explain why you want to loop it repeatedly (or do you?) and why you want to store the values elsewhere.

Posted

PatternCount ( textField ; gFind ) will give you a count...

... but a PatternCount, not a WordCount ! :

( there are 3 "a" words in your answer but PatternCount result is 17 )

( there are 5 "to" words in your answer but PatternCount result is 6 )

Posted

Oh, I agree, Daniele, and I understand how PatternCount() works. I certainly didn't mean to step on your toes and receive the 'guy-with-tongue-out' response. :crazy2:

But the reverse can also be true ...

If the person wants the word debt, would they want to count indebted or indebtedness because debt is the root? Paint and also painting, painter? Run and also runner? They would fail in your process.

The reason I asked for clear rules is simply because we may NOT need to script it at all once we know the real purpose and we haven't been given that yet. Are YOU clear on the purpose? I'm not and that's why I asked.

Posted (edited)

Well ... the purpose is as follows

I have several db connected together through the relationship.

This because all files are converted emails from my students. I have several classes and several students take more than one class.

I have a many db where I have all students enlisted in my classes, then I have other db with general questions, homework, pictures work and simple questions or other trivia.

the logical point would be to ask them to always put their students code, whatever they send me. Using the subject in the letters, or the email address they send it to, or their FACEbook stuff, or the chat they use to ask questions I communicate with them.

Yet they don't either because they just don't, or because they reply to any of my addresses no matter if the address is for the specific topic they should use at any given time, or they just clikc reply on anything and use any address they are using and so on. I need to find ways to set any mail with date and content to the right person.

I managed to get an almost full automatization using several scripts I have found but ultimately I need to know how many times and when anyone contacted me using what, about what, and or if we chat in Yahoo or get stuff from Skype or Facebook.

Often they use various emails and various nicks. I created some scripts using different ways so I may know that Student code (example) A000032, can send stuff as [email protected], or his nick in Yahoo is "WhateverNick" and in Facebook is "something_else" and different accounts.

So I have a db where I use the Student Code as a main field and a series of Logical functions which kind of tell me where the stuff I receive comes from.

To do so I paste all "Date, Time, Sender, Subject, Attachments sorts" In one great text file. From there I hope to be able to "scan" it using different values as a "pattern count" object.

Then I need to set some fields with the result so I can get a fair idea for each student work and communication.

This must sound over complex and it is ... but all I really need to do at this point is collect and divide these emails from different email accounts of mine, and other sources.

I hope this explains why the mere "pattern count" doesn't work, as several students share the same name, or looking for one name gives me several additional results ....

Thanks for helping anyhow.

Grazie a Daniele. Ho vissuto in Italia per 6 ani ma ho scordato quella bella lingua

Edited by Guest
Posted

posso inserire un value sempre diverso per la tua frase "§§§" metter un testo che cambia nella fine del record in quello field,

Il loop andrà nel secondo record e cercherà da un field lo stesso de primo o con If-else-en if in altro?

Scusami Daniele Bruttissimo Italiano ma sono Chinese

Posted

Oh, I agree, Daniele, and I understand how PatternCount() works. I certainly didn't mean to step on your toes and receive the 'guy-with-tongue-out' response. :crazy2:

But the 'guy-with-tongue-out' is a smiley face, don't you like irony?

( I know that you know what is PatternCount )

Posted

La sequenza "§§§" è una sequenza che NON capita mai di trovare in un qualsiasi testo italiano, non so se lo è altrettanto in Cinese.

Ma DEVE essere una qualsiasi sequenza di caratteri sicuramente NON presenti nel tuo testo.

Per quanto riguarda la ricerca che fa lo script: puoi far cercare la stessa parola in tutti i record modificando il quinto step dello script senza usare un loop.

--------------

The "§§§" pattern is a pattern that you could never find into an Italian generic text, I do not know if it is the same in Chinese language.

But it MUST be a character's sequenze of your choise sure not into your text field.

About the find of my script: you can find the same word in ALL the records by modify the 5th step of the script, no loop needed.

Posted (edited)

To do so I paste all "Date, Time, Sender, Subject, Attachments sorts" In one great text file. From there I hope to be able to "scan" it using different values as a "pattern count" object.

Why are you taking information and putting it into one large text field and then attempting to pull the information back out?

Do you have a Student's table and a 'numbers' table where you can relate several emails belonging to a student along with phone numbers, cels, facebook information etc. as you receive it? Do you have a classes table which can relate to your Students?

It would be simpler to use relate their email to their Student record. eMails can be saved as text, pdf (and even split into Date, Subject, Body table) and then can be searched for phrases or specific discussions. It is easy to pull an email number from a string, just as facebook accounts can be related back to the student. All information (according to using RELATIONSHIPS) to match, would then be organized. You might consider a different approach.

Edited by Guest

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