Skip 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.

vary operator with field

Featured Replies

  • Newbies

I can't seem to do this, though it makes sense to me. I'm trying to set up a comparison like this:

fieldOne fieldOperatorChosen fieldTwo

where fieldOne and fieldTwo are values and fieldOperatorChosen is a value chosen from a value list with "=, ?, <, >" as options.

I know i can do it by branching off into different script versions, e.g. if fieldOperatorChosen="<" then perform script compareLessThan... and so forth.

But there has to be a better way. I've tried getField(fieldOperatorChosen) and getField("fieldOperatorChosen") but the validation never works.

I have a feeling I'm missing something obvious, at least I hope I am. confused.gif

FileMaker Version: Dev 7

Platform: Mac OS X Panther

This looks like an ideal usage for the new Evaluate() calculation function!:

Evaluate( Quote(fieldOne) & fieldOperatorChosen & Quote(fieldTwo) )

The Quote() is needed to protect the contents of the field from the evaluate (imagine fieldOne containing the string 3+4, for instance).

I'm also not sure what you expect from ?, or is that just my browser futzing up the not= mark?

  • Author
  • Newbies

Disregard the following. I messed around with it and referenced a calculation field instead of the twice removed field in the original attempt. Thanks again.

Editted: Thought that worked but i was wrong. I don't think I know how to use this function. I'm putting it in a script to test like so:

If fieldOne & fieldOperatorChosen & fieldTwo

Set Field [matchFlag; "Match"]

where it means

If Yes = Yes

Then matchFlag="Match"

so i can do stuff later in the script...

I tried

If [Evaluate (Quote(fieldOne) & fieldOperatorChosen & Quote(fieldTwo))]

Set Field [matchFlag; "Match"]

But that's not actually working like i thought, it just happened to screw up correctly on the first test record, but actually returned that match for all records. I tried adding a test like

If [Evaluate (Quote(fieldOne) & fieldOperatorChosen & Quote(fieldTwo) "=1")] but no dice again. Is the evaluate function putting a value somewhere that I can test, there is scant little in the help or manuals about it?

Well, I tried this out myself also, and have a sample file.

It seems the expression needs to have double Quote() calls:

Evaluate( Quote(Quote(fieldOne)) & compareWith & Quote(Quote(fieldTwo)) )

This struck me as odd, and I'll admit I'm not real clear yet on why one isn't enough.

The Evaluate() function takes a string and evaluates it as a calculation, exactly so you can do this sort of thing, for example:

Evaluate( "3 + 4" ) returns 7

and Evaluate( "3 " & comparesWith & " 4" )

returns the results of "3 < 4", "3 = 4", or "3 >= 4" depending on the value of comparesWith.

Hope this helps.

Actually, a better way would be to delay the field expansion until the Evaluate():

Evaluate( "matchTest::fieldOne " & matchTest::compareWith & " matchTest::fieldTwo" )

where matchTest is the table containing these fields.

Then you shouldn't need any extra quoting at all. (but I haven't tried it).

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.