January 20, 200521 yr Hello All, Sometimes I get stuck in conceptual boxes and I suspect this is one of them. Let's see if I can put this clearly. . . In order to simplify common searches for my fellow workers, I've created bunch of "canned" searches so all they have to do is click on a button. In doing so, I suspect I have created more repetitive and redundant scripting than I need to. Let's say I am searching on two fields: a letter and a number. Each script contains a "perform find" script step that checks three different letter fields (letter1, letter2, letter3) and a single number field (number). Here are the perform find steps for the first 6 buttons: BUTTON # / ACTION / CRITERIA #1 Find Records letter1: [A] AND number: [1] Find Records letter2: [A] AND number: [1] Find Records letter3: [A] AND number: [1] #2 Find Records letter1: [A] AND number: [2] Find Records letter2: [A] AND number: [2] Find Records letter3: [A] AND number: [2] #3 Find Records letter1: AND number: [1] Find Records letter2: AND number: [1] Find Records letter3: AND number: [1] #4 Find Records letter1: AND number: [2] Find Records letter2: AND number: [2] Find Records letter3: AND number: [2] #5 Find Records letter1: [C] AND number: [1] Find Records letter2: [C] AND number: [1] Find Records letter3: [C] AND number: [1] #6 Find Records letter1: [C] AND number: [2] Find Records letter2: [C] AND number: [2] Find Records letter3: [C] AND number: [2] . . . and so forth. . . Using this approach, everytime I would want to change the search criteria, I'll have to go in and change each search parameter one at a time. Is there a method (global fields? subscripts?) where I can continue to use this "canned" search approach but compose them in such a way that I can make it easier on myself when I want to make changes? As always, thanks for your ideas!
January 20, 200521 yr When Finds become convoluted, think of using Relationships and a Portal instead. I have enclosed a quick and dirty file done in v6, that should convert okay. If not, let me know and I'll type out what is there. HTH Lee RelationshipLetters.fp5.zip
January 20, 200521 yr Since these are initiated by buttons, you might try utilizing script parameters. Have one script: Enter Find Mode[] Set Field [ Letter1 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; letter)") ] Set Field [ Letter2 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; letter)") ] Set Field [ Letter3 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; letter)") ] Set Field [ Number1 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; number)") ] Set Field [ Number2 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; number)") ] Set Field [ Number3 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; number)") ] Perform Find [] Thenin the button definition, use script parameters in the format: "letter="A"; number=1"
January 20, 200521 yr Author When Finds become convoluted, think of using Relationships and a Portal instead. I have enclosed a quick and dirty file done in v6, that should convert okay. If not, let me know and I'll type out what is there. HTH Lee Lee, Thank you so much for going to the trouble of creating that solution for me. It is much appreciated! I hadn't thought of that and it might work quite well for my situation. Can you tell me, will this solution work in a web-based situation (IWP)? (I'm away from my "Using FileMaker 7" book until later today or I would check myself.) Or will this only work in a peer-to-peer deployment? Thanks, Bob
January 20, 200521 yr Author Since these are initiated by buttons, you might try utilizing script parameters. Have one script: Enter Find Mode[] Set Field [ Letter1 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; letter)") ] Set Field [ Letter2 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; letter)") ] Set Field [ Letter3 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; letter)") ] Set Field [ Number1 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; number)") ] Set Field [ Number2 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; number)") ] Set Field [ Number3 ; Evaluate("Let ( [" & Get(ScriptParameter) & "]; number)") ] Perform Find [] Thenin the button definition, use script parameters in the format: "letter="A"; number=1" Thank you, Ender, for this solution. I had been thinking that perhaps script parameters might be the way to go with this. Since script parameters are very new to me, I'm not sure I completely understand how they can -- and cannot -- be used. Kindly forgive me if I'm being thick-headed here. . . I think I understand how one can do single-step search. Currently, the buttons (scripts) I've created all have multiple finds contained in each one (at least 3, some as many as 12). For example: Find Records letter1: [A] AND number: [1] Find Records letter2: [A] AND number: [1] Find Records letter3: [A] AND number: [1] Are "perform finds" like these also candidates for script parameters? Thanks, Bob
January 20, 200521 yr I have no experience with using IWP. However, since relationships are a basic function in FileMaker, and I've never heard of this being a problem, so I would say that it should work fine. Sorry for not being much help with this part. Maybe someone else can answer this for you? Lee
January 20, 200521 yr Anothe approach to canned seaches could be found here: http://previews.filemakermagazine.com/videos/544/SavedSearches_full.mov --sd
Create an account or sign in to comment