February 27, 200817 yr Newbies Is there a way to duplicate a find request and then add criteria to the duplicate before combining the requests? req1 is a findRequest. req2 is copy of req1. set criterion 'color1' of req1 to 'blue' set criterion 'color2' of req2 to 'blue' add both to compound request and execute. Basically what I want is to find records where either field 'color1' matches or field 'color2' matches my condition. Ed
February 27, 200817 yr Duplicate Request or Add New Request would be the the command. In ScriptMaker it's called Duplicate Record/Request or New Record/Request. The other script steps you'll want to know about are Go to Record/Request, Set field, and Perform Find.
February 27, 200817 yr Author Newbies I am trying to do this with the PHP API, so, while I could do a newFindRequest, it would not give me what I want. I need to use a set of criteria that is common to both requests, but then have a criteria that is different for each. It seems that if I clone the request object, there are references involved which means that changes to one object affect the other. I want 2 distinct requests, that happen to have a lot in common. So much in common that it seems crazy to go through all the steps of recreating the request's criteria if I can just duplicate the object.
February 27, 200817 yr Author Newbies find1, shape = rectangle find 2 = clone of find1 find1, fill color = blue find2, stroke color = blue compound find = find1 + find2 Now, what I would like to happen is to find all records where the shape is a rectangle and either the fill or the stroke is blue. NOT just records where fill and color are both blue. It seems that adding the stroke criteria to find2 is also adding it to find1!
February 28, 200817 yr Sorry about that, Edmond. I tend to click on "Recent Topics" and half the time I forget to even check which forum I'm in. I'm afraid I don't know the PHP solution, but there must be one. At the very least you should be able to make a new find request and then get your criteria from existing variables.
February 28, 200817 yr Author Newbies no problem. : I ended up abandoning the clone/duplicate shortcut and just created the two in parallel until the point at which they diverge. Not very elegant, but it works.
March 3, 200817 yr Here's a basic example of a compound found with the FM API: $request = $fm->newFindRequest('associate_layout'); $request->addFindCriterion('Account Name', 'M'); $request2 = $fm->newFindRequest('associate_layout'); $request2->addFindCriterion('Account Name', 'T'); $request3 = $fm->newFindRequest('associate_layout'); $request3->addFindCriterion('Status', 'Active'); $request3->setOmit(TRUE); $compoundFind = $fm->newCompoundFindCommand('associate_layout'); $compoundFind->add(1, $request); $compoundFind->add(2, $request2); $compoundFind->add(3, $request3); $compoundFind->addSortRule('Account Name', 1, FILEMAKER_SORT_ASCEND); It essentially says in ScriptMaker Terms: Enter Find Mode[] Set Field[status;"Active"] Perform Find[] Show Omitted Only Enter Find Mode[] Set Field[Account Name;"M"] New Record[] Set Field[Account Name;"T"] Constrain Foundset[] Which really just says find all records that have M or T in the Account Name and don't have a Status of Active
Create an account or sign in to comment