Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

complex find: AND & OR logic

Featured Replies

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.

 

 

 

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 []

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.