effa Posted August 23, 2013 Posted August 23, 2013 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.
doughemi Posted August 23, 2013 Posted August 23, 2013 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 [] 1
eos Posted August 23, 2013 Posted August 23, 2013 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 1
Recommended Posts
This topic is 4110 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