dbTalk Databases Forums  

Solution for the question: Select a single word in a text field after a search

comp.databases.filemaker comp.databases.filemaker


Discuss Solution for the question: Select a single word in a text field after a search in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Carlo
 
Posts: n/a

Default Solution for the question: Select a single word in a text field after a search - 07-30-2003 , 06:11 AM






In Filemaker 6:
Define a global field named "gSearched_word" to store word that you
want to find.

Make a script to enter in find mode as below:

Script 1
Go to Layout ("mySearchLayout")
Enter Find Mode (Pause)
Set Field("gSearched_word)", "myField")
Perform Find(Replace Found Set") (or other option)
Go to Layout("myResultLayout")
Perform Find/Replace("gSearched_word", " ", "Find next") (see other
option on "Find next" parameter, ecc)

Make a new script to hilite the next occurence of word
Script 2
Perform Find/Replace("gSearched_word", " ", "Find next")

Insert a button to perform this script in "myResultLayout"
That's all.
Bye. Carlo

Reply With Quote
  #2  
Old   
Bridget Eley
 
Posts: n/a

Default Re: Solution for the question: Select a single word in a textfield after a search - 07-30-2003 , 06:10 PM






Hi Carlo

Unlike find, find/replace is not taken out by edit only privileges (although
password privileges still apply with regard to modifying records) which
makes me wonder why you would ever need to script something like this.
Command-Shift-F (or equiv Windows shortcut) will bring up the find/replace
dialog and find the first instance, while Command-G (or equiv Windows
shortcut) will find the next instance (even after you have closed the dialog
box).

However, if there really is a reason why you must do it this way, why not
make use of a custom dialog in your script. Values can be entered into
global fields via the dialog, doing away with the need for extra layouts.

Also, a loop and a pause/resume script step would allow users to use the
Enter key to view each instance of the search string, instead of having to
click a button each time.

Set Field [ gText1, "" ]
Show Custom Dialog [ Title: ³SEARCH STRING²; Message: ³Enter search
string.²; Buttons: ³OK², ³Cancel², ³²; Input #1:
gText1, ³Search String² ]
If [ Status(CurrentMessageChoice) = 1 ]
Enter Find Mode
Set Field [ text, gText1 ]
Perform Find [ Replace Found Set ]
Loop
Perform Find/Replace [ Find: gText1; Replace: ; Search operation: Find Next;
Search settings: Forward; Search across: All records/requests; Search
within: All fields ]
Pause/resume []
End Loop
End If

NB: This script would be improved by error checking for no records found,
and by giving the user the choice to modify search criteria, and to replace,
constrain or extend the found set, but I have kept it simple here for the
sake of clarity.

Bridget Eley

in article 9b1b0094.0307300311.2ae8873f (AT) po...OT) google.com, Carlo at
ercar (AT) hostlcnet (DOT) it wrote on 30/7/03 9:11 PM:

Quote:
In Filemaker 6:
Define a global field named "gSearched_word" to store word that you
want to find.

Make a script to enter in find mode as below:

Script 1
Go to Layout ("mySearchLayout")
Enter Find Mode (Pause)
Set Field("gSearched_word)", "myField")
Perform Find(Replace Found Set") (or other option)
Go to Layout("myResultLayout")
Perform Find/Replace("gSearched_word", " ", "Find next") (see other
option on "Find next" parameter, ecc)

Make a new script to hilite the next occurence of word
Script 2
Perform Find/Replace("gSearched_word", " ", "Find next")

Insert a button to perform this script in "myResultLayout"
That's all.
Bye. Carlo


Reply With Quote
  #3  
Old   
Carlo
 
Posts: n/a

Default Re: Solution for the question: Select a single word in a text field after a search - 07-31-2003 , 12:16 PM



Your script is very useful. Thank you Bridget
Best regard

Carlo

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.