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.

Search with OR instead of AND with a repeating global field

Featured Replies

I have a drop down list where it is necessary to search for any of the items in the list that are selected (by holding down the command (apple) key). This creates a repeating field entry in the find global. The field it is searching is not a repeating field and therefore would never match the repeat of the find global. Is there a way to take each entry in the repeating field and have the search return any records that match any of the words in the repeating find field?

Thanks,

Drew

Too weird... we both asked basically the same question at the same time... Honest folks... we don't work together.

Haven't tried it, but how about a scripted find?

Select each of the repeating values one at a time with the '[X]' bracket option after the field name and extend the set for each one.

Yes/No?

  • Author

Sounds like an idea... The find is already scripted so some particulars are needed so I can implement them in to the script.

Matt Petrowsky has several tutorials on this at:

http://www.filemakermagazine.com/index.php

Do a search for "OR search" and chose technique and you'll see the list.

HTH

You don't need a repeating field for this. Just make a script along the lines of:

# CREATE THE FIRST REQUEST (N = 1)

Enter Find Mode [ ]

#

# START LOOP

Loop

#

# SET THE SEARCHED FIELD TO THE Nth VALUE OF VALUES TO SEARCH FOR

Set Field [ Table::Value; MiddleValues ( Table::gValues ; Get ( RequestCount ) ; 1 ) ]

#

# IF THERE ARE NO MORE VALUES (N ≥ VALUECOUNT), WE ARE DONE

Exit Loop If [ Get ( RequestCount ) ≥ ValueCount ( Table::gValues ) ]

#

# ELSE, CREATE A NEW REQUEST AND REPEAT THE LOOP WITH N = N + 1

New Record/Request

End Loop

#

#

Perform Find [ ]

In this example, 'gValues' is the field that holds multiple values to search for (your drop down list) and 'Value' is the searched field.

Edited by Guest

  • Author

Although I can understand most of the script there is some of it that is a little fuzzy for me. I was not able to make the script work, I kept getting an error when I did some of the calculation entry. What would be really helpful is if you could dissect the script and caluculations for me. I know that is asking a lot but it is like teaching me to fish instead of just giving me the fish. In the future I will be able to better help myself.

Thanks so much!

Drew

On each loop, the script creates a new find request. The request number is used to pick the corresponding value from the stack of values to search for. When the number of requests equals the number of values to search for, we are done.

I have edited my previous post and added some comments (and a minor simplification). If you still experience problems, post the exact error message and what did you do before you got it.

  • Author

When I enter the set field exactly as shown I get "a number, tesxt constant, field name or "(" is expected and it High Lights the first bracket.

Can you be more descriptive? The MiddleValues() function in the Set Field[] above looks right to me.

  • Author

I just had to enter it a bit different and got it to work great! Thanks for all the help!

This is what I did instead.

Enter Find Mode []

Loop

Insert Calculated Result [select; Table::Value; MiddleValues ( Table::gValues ; Get (RequestCount) ; 1 )]

Exit Loop IF [( Get ( RequestCount ) ) ≥ ( ValueCount ( Table::gValues ) )]

New Record/Request

End Loop

Edited by Guest

  • Author

After implemting it and reading the help files related to all the used functions I understand what is going on. Thanks so much for this. Without your help I dont think I would reached this good of solution!

Edited by Guest

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.