I created a field called "search item"
When I try to add this to a script find step it is greyed out and will not let me select that field.
Need a little more info. Your question reads like you are trying to search in a global field. Global fields have the same value for ALL records, and live only as long as the FM session ( until you close the file ), if it is a multi-user file.
You can't enter search criteria INTO a global field for the reason already posted: every field in the table will have the same value in a global field, but you can get search criteria OUT OF a global field.
See the first part of this thread for some examples:
Scripted Find Examples
Thanks for the responses, both of you. philmodjunk I read your sample the other day. It's a comprehensive post and I thank you for it but I've worked through it a few times and cannot seem to get the results I'm looking for.
I want to pop a dialog box up that asks a user what they want to search for (only one field). Capture that search string to the global field (which I think I am doing as I can issue another dialog box back and show what I captured. Things fall apart when I try to use that field value to search on. It [the field I try to select] is grey when I go into the step in my script.
Better make sure that the field has global storage specified then.
You might also post a screen shot of where you see this option greyed out. (the picture tool above will let you insert a picture directly into your reply here.)
gt field is global now, then grayed in list of fields (but wasn't global, then could be selected and appear on upper)
The field selection is for "INTO" what phil wrote, and in FM you can't find field value comparing to another field (not only to global field).
You need set variable using global field value, then use variable as criteria to search target field (shouldn't be global).
Better look again at those examples that I recommended. You can't use stored Find criteria for this technique and that's what this dialog is used to create.
You need to use set field to set up your find requests when using this method.
This sounds like something I do all the time, but I'm not sure exactly your setup from the description so I'm only guessing here: you want to pop a dialog box allowing someone to enter search terms, and then use those search terms to find that value in one or more fields in the table/view.
I guess the question is, why are you wanting to search the global field? Global fields in FM are basically the field equivalent of a Global Variable; you put stuff there to store temporarily, and call for it when you need to use it. Global fields are also context independent, since there's no difference in its value wherever you are in the system, so you can call its value from any table layout in the file.
An example of what I mean: table "Sessions" has 3 fields, "Name", "Location", and "Moderator." You want to allow users to search in any of those three fields, so you create a global field as well, called "g_Search":
This will return records where the g_Search value entered is found in any those fields. You can also use a Quick Find, which searches all QF enabled fields on the current layout, if your layout is so configured.
You can keep the value in the global field if you only use the field for this purpose, if you don't mind the previously searched value popping up for the user. Otherwise, your first or last script step would be to set the field to "".
Hopefully this helps, and I'm not completely misunderstanding your question. Reading comprehension and I are not on friendly terms.
It can help us to help with a script if you post the script itself. Apart from that, a couple of observations if I may:
1. Although you don't exactly say so, I am assuming your intent is to have users enter some Find criteria into a field in Browse mode, then with your script use the criteria entered to perform a Find on certain field or fields in your database.
2. If the above is correct, then the process should look something like this—
(1) the field into which users type their criteria should be a global field
(2) your script can be a simple as—
Enter Find Mode [ ]
Set Field [ <table and field name you wish to search in> ; <table and field name of the global field> ]
Perform Find [ ]
(3) the above script is much simpler to assist with (and to write and manage for that matter) as each step is quite explicit.
(4) the logic is that the user types some data into a global field; the script uses that data to perform a search in another field
(5) an example would be that you want to find any person in a Contact database whose first name is Rosie; you type Rosie into a global field; you click a button which runs the script, searching for Rosie in the FirstName field.
I prefer not using "Find [Restore]", and you looks making a mistake
This doesn't search using value of users::gt field, text of "users::gt".
I guess you use "Enter find mode" then "Set Field", this can have [value: globalField] and works well.
(hmm, but the step doesn't have value: lavel ?)
You are correct, the value needs to be pulled into a variable to use Perform Find [Restore], or he can loop through New Request/Set Field steps inside Enter Find Mode/Perform Find. Thanks for the heads up!
Retrieving data ...