Assuming that you have a record for every word in that description field and assuming that you are NOT using FileMaker GO, then yes, you can click a word and trigger a script that first isolates the word that was clicked and then uses that word via a scripted find or a relationship to pull up the record for that word.
Here's a demo file you can examine: https://dl.dropboxusercontent.com/u/78737945/WordSelector.fmp12
The script uses Get ( ActiveSelectionStart ) to determine the exact location clicked. (This is the part that fails in FM GO.) It then uses loops to scan left and right from that location to isolate the specific word that was clicked. The Filter function is used to remove all punctuation from that word. This function call can be modified to allow specific additional characters to be included such as the apostrophe and/or the hyphen if such is needed. The resulting word is then put in a match field so that a relationship matches to a specific record in a related table.
I swear scripts hate me. Or I just don't understand them well enough to figure out and fix the problem. (Anything I can to get a better understanding of scripts?)
For the demo, I noticed that you had two tables, so that when you click in the paragraph box in the data table, it brings you the word and definition in the defiinition table. Do I need to have 2 tables to get this to work? I seem to be stuck in another loop, even though I want to go to the record instead of brining up a dialog box, I can't get the dialog box to pop up.
I seem to be stuck in Scan right exit loop, the $start local variable value just keeps going up. I've tried to copy your demo, by making a relationship between a test table, and my Main table, but am still stuck in a loop.
I tried the script again, and the $start local value goes down from 26.
This is the script....I changed the tables, and I know I have to get rid of the Show custom dialog box, but I"m not sure what to put in its place to get it to go to the correct record instead of displaying a dialog box.
To repeat from my first post, once the script has extracted the actual word that was clicked, it can use either a relationship or a scripted find to pull up the desired record. The demo file used a relationship to match to a specific record in another table, but that is not the only option. You can also use a self join relationship to bring up a record in the same table as that on which your layout is based or a scripted find can pull up that record.
Your imported script has numerous steps where the calculation used inside the script step is still enclosed in /* comment brackets */. You need to remove those brackets ( /* */ ) before the script can perform correctly.
FileMaker added those brackets when you imported this script (or copy/pasted the steps) from the demo file due to the fact that they contained table::field references to items in the demo file that do not exist in your file. You appear to have updated the expression, but left the brackets.)
Thank you for the help! I've gotten most of it to work, I created a self relationship, but I've run into an odd problem. When going from Set Field LAS::Description to Show Custom Dialog box, the Description box gets edited, erasing most of the text in the box.
To be able to pull up the corresponding entry when clicking on the word in the description box, would I add GoToRecord? Or something similar?
Yep, your that's because you set up your script to do exactly that. You need to define a new text field, and use the set field step--the second to last step in your script to set it instead of Description to the clicked word. But I don't your self join won't work even if you use the new text field as a match field because you don't have an exact match between the clicked word and text in a field in your record, the description field can't be used for this because it also contains other text.
Please describe, in terms of the records in your table, exactly what you want to see happen when a word in the description field is clicked. Right now, it looks to me like you want to "find" the record that you are already on and that makes no sense. You will likely have many records with the same word in the description field, which of those records is the one you want to pull up with this mouse click and how can you determine, just by looking at the data in your fields which is the correct record to pull up?
In the description box, I would like to be able to click on the word Silly, and have it bring me to that record. So instead of having to use the search function to find the record Silly, I would like to able to click on the word Silly and have it take me to that record.
There would be instances where multiple records would have "Sign Silly (SEE) with 'letter' ". But in each case you would click on the word Silly, and it would bring you to that record. We only need to click on certain words in the description and be taken to the correct record. 99% of the time the word will be formatted as "Sign Silly (SEE) with 'letter' ". I will only need to click on the "Silly" word to be taken to the record. The rest of the words don't matter, and won't be clicked on.
And what record is "That Record"? What do you see in your database out of all the records that have "Silly" in the description field that identifies the record to be pulled up as "That Record"? Is it a record that has "Silly" and only that text in the description field?
That record would be the Silly record. Any other record that has "Silly" in the description when clicked would take you to the "Silly" record.
I think for this to work, I'll have to change the self relationship from Description=Description to Description=Sign Name (which is the big bold Silly). Because thats what I would need to be pulled up.
Ok, that's the detail I was looking for. While you are close, you are not quite there yet.
As I recommended earlier, you need to define a new text field in your table. Let's call it "clickWord".
Define your self join as:
YourTable::ClickWord = YourTable::Sign Name
Then your script can set ClickWord to the value extracted by the script and then Go To Related Records can be used to change the current record on your layout to that of the word you clicked. (Unless you prefer to display data in the custom dialog instead.)
You can also use that relationship to check to see if a matching SIgn Word exists before either showing the custom dialog or using Go To Related Records.