August 23, 201312 yr I'm creating a find form which has several regular fields (where user can choose from drop down menu) and 1 field with 5 checkboxes. I need to make a script which will perform find through regular fields and checkboxes. User should be able to check e.g. first and fifth checkboxes and script should find all records with first OR fifth checkboxes (now it looks only for records with both first AND fifth which is wrong); and after this combine this find with other fields (using AND logic). I understood that I need to use extend found set however I'm not too much familiar with coding. I try to use the following script which does not work correctly: car_number is checkbox field Set Error Capture [On] Perform Find [] Set Variable [$cars; Value:db:car_number] Enter Find Mode [] Set Variable [$K; Value 1] Set Field [db::car_number; GetValue ( $cars ; 1)] Loop Set Variable [$K; Value: $K + 1] Exit Loop If [$K > ValueCount ( $cars ; $K )] Extend Found Set [] End Loop If [Get (LastError) > 0] Modify Last Find Show Custom Dialogue ["Error"; "No records found."] Exit Script [] End If New Window [] Go to Layout ["db" (db)] Can you please help me to modify it so it will perform find through checkboxes using OR logic and then regular find thorough other fields.
August 23, 201312 yr Using NewRecord/Request performs the OR function in a find. Using Constrain Found Set allows you to perform the AND function with the found records: Enter Find Mode [] Set Field [db::car_number; 1] New Record/Request Set Field [db::car_number; 5] Perform Find [] Enter Find Mode [] Set Field [db::other field; "Desired Value"] Constrain Found Set []
August 23, 201312 yr The problem when using regular fields (as opposed to globals) for the entry of the search criteria is that you need to capture and clear the checkbox before starting to search; otherwise the selected value(s) will be included in the first search, and the variable you set will contain the values from the first found record if any), not from the search request. It's easier to first search for the other search criteria, then build up the check box requests and use Constrain once outside the loop. See if this helps you; simply use your values to check the logic and adjust the flow. ANDOR_eos.fp7.zip
Create an account or sign in to comment