Jump to content

Search Box (I apologize)


Aragorn
 Share

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

Recommended Posts

I apologize for asking this same old question but I didn't find what I wanted through a search....

Iwant to make asearch box to search multiple fields and then showthe results in a list and then the user can click the record they want and go to the full record...

I know I need a calculated field and to associate the fields I want searched...but I I can't seem to get the results right...for instance, the fields I want searched are Unit Plan and Lesson Plan...if I type in Basketball I get answers like Basketball/Dribbling (unit is basketball, lesson is dribbling). I would like the results to just list the records like a Google search (if that makes sense)...

thx again for all your wonderful help!!

Version: Developer v6

Platform: Windows XP

Link to comment
Share on other sites

One technique for doing a search for one word in multiple fields is to make a calculated field which is the concatenation of the fields you want to search. Then you just search for the word in this calculated field. That works well if you are not doing an exact search.

But, it sounds like you want to an exact search on multiple fields. To do this you would need a script that takes the search text from a global field (let's call it gSearchText) and then does a scripted find like so:

Enter find mode [

Link to comment
Share on other sites

Hi Aragorn,

Further to Bob's comments, you may find the demo at:

http://www.nightwing.com.au/FileMaker/demos4.html#d6

- which is appears under the heading 'Automating the Performance of Multiple Finds', to be of interest in relation to the second of Bob's suggestions. wink.gif

Link to comment
Share on other sites

Right now I can't get at the Nightwing demo, so if the extra bells & whistles I detail below are already covered, I apologize for the waste of bandwidth. In case they aren't, this should answer the rest of Aragorn's question:

I do this sort of thing a lot. I add a couple of If statements to the script given above. First a check to make sure they enter *some*thing in the search box:

If (IsEmpty(Searchbox))

Show message ("You must enter something in the box.")

Exit Script

EndIf

**Proceed with Find script as above**

Then, after the find operates, I have a test to see if zero, one, or many results were found:

Set Error Capture (On) (To avoid an FM "nothing found" error)

Perform Find (**Restore off**)

If ("Status(CurrentFoundCount) > 1")

Go To Layout ("SearchList")

Else

If ("Status(CurrentFoundCount) = 0")

Show Message ("Nothing was found matching your search criteria")

Show All Records

EndIf

EndIf

If nothing was found, you get the message and you stay where you are (I'll call it the "Detail" layout). If a single match is found (the leftover results after > 1 and =0 have been dealt with) you simply stay on Detail, displaying your single result.

But if more than one is found, you go to a layout I call SearchList (if you will have a lot of results, you might insert a sort step to aplphabetize them or something after the GoToLayout step). This is a list view containing just enough info to identify an item. I database books, so I display ISBN, Title, author, price in this list. Set all fields in the list to not allow entry.

Now there are a couple of ways to go. One is to put a long skinny transparent box on top of the entire list body part and define it as a button. Make this button a simple nav button that will go to the Detail layout.

The effect is being presented with your list of results, click anywhere in the line of the item you want, and you're back on the full display layout (Detail).

Steve Brown

Link to comment
Share on other sites

Steve THANK YOU!! I said it before and I'll say it again...scripts seem to be the meat & potatos of this program....and its also where I have the biggest problems....

Now I am assuming the Layout "SearchList" is in List mode? If so do you have it where users can click on the record they want and be able to go to it? Also if that is true, how do they get back to the found list?

Thank you SO much!!!!

Link to comment
Share on other sites

I'm not quite sure what you mean by List Mode. Make a new layout from scratch, and choose List from the initial option list.

By using the superimposed transparent box defined as a button, users can click on the record they want and go to the detail view or layout you want them to see. The button is just a "Go To Layout" defined button, with the layout being the one you do most of your data viewing and/or entry.

Remember, in a true list layout, you should only get one line of type all the way across. Right under it is another line of type representing another record, with a third record under that, etc. A typical list of this kind may display twentty or thirty lines (records) at a time. When you place the transparent button box on top of the fields in Layout, in Browse mode it will be there, invisibly, on top of each line of text. The line you click will be the active record and the navigation will take you to a display layout for that record.

At the time users are viewing their selection, you still have a found set of your search results. On your main layout you could stick a small button called "Back To List" that would simply return to the SearchList layout.

Users click the one they want, and if on further viewing they decide it was the wrong one, they click the "Back To List" button and select another. If their choice is not in the list, or if they do any finding that changes the found set, they'll have to start over and re-enter search criteria and rerun the main script.

Steve Brown

Link to comment
Share on other sites

This topic is 6522 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.