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.

Using "OR" for form fields searches

Featured Replies

Hi!

Here's the description:

I have a library database, and I need to perform search on book titles. The problem is that some books contain articles inside themselves (implemented with related records).

When a search is performed, I need to search for a "title" either in main book info, or inside articles which belong to that book.

Currently, it is implemented so that user can either enter search string into "main title" field, or "related title" field in the search form.

What I'm trying to do is to unify this search, so that in search form I have a single "title" field and the script would find books which either have corresponding "main" titles or "article" titles.

Currently, I'm thinking about having the "main" title search string to be copied into "article" title field before the search is actually performed.

BUT! In this case search is performed using logical "AND". Is there a way to make it use "OR"? I mean "search for books where (main_title="title" OR article_title="title")"

Any suggestions are very welcomed!!

TIA,

Mike

You ca do this via a script. Create a global text field (gTitle) and place it on your find layout. Create a script that takes the user to the find layout. The following script would need to be launched via a button after the search text is entered into the gTitle field. This is not exact, but it may get you started:

Enter Find Mode

Set Field (main_title,gTitle)

New Request

Set Field (article_title,gTitle)

Perform Find

"AND" searches are performed by entering data into multiple fields of the same Find Request in Find mode. "OR" searches are performed by entering data into multiple Find Requests in Find mode. That's why the scrip step is "New Record/Request/Page", because it acts differently depending upon the mode you are in. When you enter Find mode, you are give a single Find Request to enter data into. If you want additional Find Requests, they can be created from the Requests menu or usin the above script step. If you wish to omit records with a certain entry, you check the "Omit" box in the status bar. Scripting you find might look like:

Enter Find Mode

Set Field (Book Title, "How to Create OR Searches")

New Record/Request/Page

Set Field (Article Title, "How to Create OR Searches")

with an Omit, the script looks like

Enter Find Mode

Toggle Status Area (show) <--- Must show when using Omit step

Set Field (Book Title, "How to OR Searchees")

New Record/Request/Page

Set Field (Article Title, "How to Create OR Searches")

New Record/Request/Page

Set Field (Database Produce, "Microsoft Access")

Omit

This script would find all the book or articles on OR searches, but omit those where the mythical database field is set to Microsoft Access.

-bd

  • Author

Oh my god!! It works! Thank alot!

I never knew such an operation is possible with FM!

Mucho gracias! laugh.gif" border="0

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.