Agent Ska Posted May 21, 2008 Posted May 21, 2008 I have a built a script to execute a find request - however the returned results are not the same as if I create the find request mannually. The reason for the script is to utilize a graphical interface to simplify an and/or/omit type of search across several keyword fields. To make life easy, I created two concatenated fields that are strings of all the keywords associated to the record. When searching, we search on those two fields. So, for example - keyword1 is "blue" and keyword2 is "Wine" If you search indvidualy for "blue" you get 24 records returned and "wine" returns 116 both from the script and manaul finds. However, if you search for "blue" or "wine" manually you return 138 records. The script only returns 116 however. And, if you search for "blue" and "wine" manually you get 2 records back. Via the script, you do not return ANY records. When I get the no records found error, if I click modify find, I can see the search terms appear to be just the way I want it. In the "And" case there is only one find request, and searchString1 is "blue" and searchString2 is "wine". When I click continue script, I get the same error. Why would the script be producing different results?
Søren Dyhr Posted May 21, 2008 Posted May 21, 2008 Because you never turn into find-mode, by the look of your script. http://www.filemaker.com/help/Script-Steps26.html --sd
Agent Ska Posted May 21, 2008 Author Posted May 21, 2008 Sorry, I only sent the portion of the script that deals with creating the find, The first script that is called changes the layout to bring up my GUI search layout, clears all previous search terms, and enters the find mode. So, we are actually in find mode as the script is working - otherwise, I would be changing the search strings of an actual record.
Søren Dyhr Posted May 21, 2008 Posted May 21, 2008 Ok! Are the searchvariables global fields you won't get any values from related tables not global, otherwise load the values into a pair of $ variable before turning into find-mode ... what is weird is you have correct values when you issue a: http://www.filemaker.com/help/Script-Steps74.html ...or do you? --sd
Agent Ska Posted May 21, 2008 Author Posted May 21, 2008 Ok! Are the searchvariables global fields you won't get any values from related tables not global, otherwise load the values into a pair of $ variable before turning into find-mode ... what is weird is you have correct values when you issue a: http://www.filemaker.com/help/Script-Steps74.html ...or do you? --sd Yes SearchTerm1 and 2 are global fields. I do not issue a "modify find" command at any point. However when I get the "no records returned" error, if I choose the "Modify Find" Button, I can see the find request looks like I would create it, but I still get no records returned.
Søren Dyhr Posted May 21, 2008 Posted May 21, 2008 Have you interchanged the values your're setting? Why not make us a template of this specific area of your solution?? --sd
mr_vodka Posted May 21, 2008 Posted May 21, 2008 In the "And" case there is only one find request, and searchString1 is "blue" and searchString2 is "wine". When I click continue script, I get the same error. It looks like we need to figure out what your definition of "AND" and "OR" are. A FileMaker AND find would only product 1 find request. The OR find would have a second request. Please supply examples of what you are looking for exactly.
Agent Ska Posted May 21, 2008 Author Posted May 21, 2008 I'm not sure that I understood your interchange question. Here's a stripped down version of the database that I am trying to deal with. searchTemplate.fp7.zip
mr_vodka Posted May 21, 2008 Posted May 21, 2008 Perhaps you can simplify it. This sample uses exact finds for your keywords. searchTemplate.zip
Søren Dyhr Posted May 21, 2008 Posted May 21, 2008 I came to think ... this is actually two and searches isn't it? I would rather keep my sanity by disributing the keywords inside the same request if it's an AND'ed search, and similar distribute the keywords diagonally when OR'ing with the creation of enough requests - via the scripting only. I would not use a calc'field based upon a global field, as suggested in the original template. --sd
mr_vodka Posted May 21, 2008 Posted May 21, 2008 Yes I somewhat agree with you but I wasnt sure how many fields ultimately there would have to be searches across in the OP final solution. Also, I was just trying to modify Agent Ska's file.
Agent Ska Posted May 21, 2008 Author Posted May 21, 2008 I came to think ... this is actually two and searches isn't it? I would rather keep my sanity by disributing the keywords inside the same request if it's an AND'ed search, and similar distribute the keywords diagonally when OR'ing with the creation of enough requests - via the scripting only. I would not use a calc'field based upon a global field, as suggested in the original template. --sd I'm sorry - I am not following this at all.
Søren Dyhr Posted May 22, 2008 Posted May 22, 2008 Putting keywords in several fields in the same request performs and AND'ed search, no need to concatenate them into a string ... unless the number of records is whopping near to datamining (Gigabytes of data), where unnecessary individual indexing of fields should be avoided. Then would a simple string not even be enough - a cartesian product of the key values should be the result of the calc' To do the same OR'ed will you need to count the number of criterias before looping each value gets it's own individual request ... such a script would if you look at your fields in table view stuff the keys into the grid diagonally. Check this out if you should happen to subscripe to it?? http://www.filemakermagazine.com/videos/faster-or-search-script.html --sd
Recommended Posts
This topic is 6031 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 accountSign in
Already have an account? Sign in here.
Sign In Now