July 23, 200421 yr I have a find mode problem. I have created a database to store collectors cards. If the user clicks on the find button it will bring them to a find layout and I run a script for them to do their search. The problem I am running into is I want the search for one field to be constrained only to what they pick. Example I have a field called series and I have a drop down menu so they can pick the series. The user can also add a series that is not in the database. If the user picks 'series 1' it will pull all the series 1 and series 11,12,13,14,15,&16 cards. So I thought I would put in an if statement so that if they pick 'series 1' it would constrain == to 'series 1'. This works great. Now I added a new series called '2004 series 1' and did a search for 'series 2' and it now pulls the '2004 series 1' since it has a '2' in the name. How can I get filemaker to perform a find that is constrain only to what the user picks? I actually only want that one field constrained. I don't want the card name field constrained since I want them to be able to type in just a few letters of a name and let it do a search. This is confusing. Thanks for the help.
July 23, 200421 yr Author No. I use a popup menu for the user to select. There are no quotes around each item.
July 23, 200421 yr Assuming the find is scripted, you could add the quotes around the item once selected using Set Field [field, """" & field & """"].
July 23, 200421 yr Author I am using a scrip, but I may be a little confused on how to just set this one field since I am not sure which field(s) they are going to select for their search. how would you set this up after the perform find [] script? Also how would you know what field the user selected, would you need an if statement or could you blanket cover all fields the user selects? Thanks alot for your help
July 23, 200421 yr This would be before the Perform Find step. I would use a separate find layout that contains global fields to search. Then test the globals that are formatted as menu/list and if their WordCount is greater than 1, use the Set Field [textfield, """" & globalfield & """"] step to ensure that only the exact pattern is found.
July 23, 200421 yr Author My database is setup exactly as you mentioned with a seperate find layout. This layout matches all the fields exactly as the main layout. My 'series' field is not a global field. I put in just the Set Field [cards::series, """" & cards::series & """"] before the perform find step and I still get the same results. I didn't put in the wordcount condition. I want to keep the field the same as the main layout for series, since I want to give the user to change this field after perfoming a find.
July 23, 200421 yr I edited my post above. I meant to use global fields in the find layout. You can't set a related field in Find mode, since there are no valid relationships. DOH! Nevermind, you're using 7. So I'll assume that's a table reference, not a relationship.
July 23, 200421 yr Attached is a simple example. Perform the first script and enter a d. Then perform the second script and enter a d. Note that the first will find the only record in the file, because there is a space between the criteria. The second, however, will not find anything, because the quotes force the exact pattern to be searched. Find.zip
July 24, 200421 yr Author Thanks, But I put in my data and I still have the same results with 'series 1'. series 2 works now. what does the / in between the "" mean? I have attached the file with the data I am using. Let me know what you think, It doesn't make sense to me why it would not work with the other. Find.zip
July 24, 200421 yr Author I have added a few more records and also added another field called backing. If you do a search for series 1 and blue backing you will also get all the teen series. This is driving me crazy. The series 1 is the problem. It listes everyting with series and a 1 in the title. Find.zip
July 24, 200421 yr Author I have now spent about 12 hours trying to figure this out. Queue you are my only hope. The problem obviously has to do with the way filemaker searches text. If you don't define the search it will find any words that match. there has to be a way to have the user define the EXACT search from a select list of options (pop up menu). Adding the quotes didn't work to set field. I am losing sleep over this. Thanks for all your help
July 24, 200421 yr An == at the start of the field forces an exact match of the entire record contents with your pattern: ==series 1
July 24, 200421 yr My bad. Shadow good. I have no idea why I didn't suggest that first. This week has been too long for me. Instead of the quotes, Set Field [text, "==" & text]. For some reason I was thinking you wanted partial matches also. I must have been reading another thread. An alternate idea (and probably faster than the find) is to use a global field for the find and create a relationship between the global and the text field. Then, once the criteria is selected, a simple Go to Related Record [show only related, global_to_text_relationship] will suffice.
July 24, 200421 yr Author Queue, you crack me up. I tried you suggestion and it still doesn't work properly. I What I need to happen is that we get exact matches for either series and backing or both (if the user selects both). I have search through the help, searched internet, & read learn filemaker pro 7 book and nothing like this is covered. In Access you can select whether you want to search for exact or partial match. Frustrating. You have been a great help.
July 24, 200421 yr Author WAIT. HOLD THE PHONES!!! I think it is working now. I had too many spaces in criteria. I will have to test it today. WOW, how is anyone supposed to figure this out. You are amazing!!!
July 24, 200421 yr Author OK I spoke too soon. Now another problem has risen from this. Now I can't search on any other field than series. I have attached the file. Obviously, now that it is scripted to match series it will ignore the other fields. If I search for series and another field it works. If I search for another field other than series it gives me an error. Wow, this shouldn't be this hard. Find.zip
July 24, 200421 yr The script must not add the "==" if Find::Text is empty - == by itself will search for empties on that field, try changing the step to: Set Field[ Find::text; If (not IsEmpty(Find::text); "==") & Find::text ]
July 24, 200421 yr Just add this if statement to your script: If [ not isempty( text ) ] Set Field [ text ; "==" & text ] End If
July 24, 200421 yr Author That's it!! Thanks Shadow. I used you first example and that worked great. unbelievable!!! Thanks you guys you are awesome. How in the heck is someone supposed to figure this out? There is no documentation on this that I have found. Is there a good book on all the different variables you can use and the proper syntax?
Create an account or sign in to comment