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.

Can't use Evaluate () in Custom Function?

Featured Replies

I'm trying to figure out why I can't use the Evaluate () function in a custom function (at least in the way I want). Here's what's going on...

I downloaded a sample file from http://www.databasepros.com (created by Reed Wycuff) of this nifty little ChangeLog2, which shows how to use a single auto-enter calc to create a change log. While looking at the formula, I thought it would be really cool to make it into a more modular Custom Function. I took the original formula of:

[color:blue]Let([x = Evaluate("Get(ActiveFieldContents)";[[color:red]Text;Number;Date;Time[color:blue]]);y = "[color:red]Text:Number:Date:Time[color:blue]"];(

Case(

PatternCount(y;Get(ActiveFieldName));

"- " &

GetAsText(Get(CurrentDate)) & " | " &

GetAsText(Get(CurrentTime)) & " | " &

Get(AccountName) & " | " &

Get(ActiveFieldName) & " = " &

x &

Case(not IsEmpty(Log);"¶") & Log

)))

and tried to substitute the actual names of the fields (shown above as Text;Number;Date;Time)with Function Parameters (field1;field2 ) I defined in the Custom Function dialog, as you'll see in the following:

[color:blue]Let ( [x = Evaluate("Get(ActiveFieldContents)";[[color:red]field1;field2[color:blue]]);y = Substitute ( "[color:red]field1;field2[color:blue]" ; ";" ; ":")];

Case(

PatternCount(y;Get(ActiveFieldName));

"- " &

GetAsText(Get(CurrentDate)) & " | " &

GetAsText(Get(CurrentTime)) & " | " &

Get(AccountName) & " | " &

Get(ActiveFieldName) & " = " &

x &

Case(not IsEmpty(logField);"¶") & logField

))

[color:black]I figured that in doing it this way there'd be no chance of one field name occurrence not jiving with the other occurrence in the formula, thus making setup and maintenance of the log really simple.

Thanks in advance for any suggestions offered!

  • Author

No takers on this one??? :)

Maybe I gave too much info in my original post so let's try this...

Try to create a Custom Function with the following 3 parameters defined:

Whatever

FieldA

FieldB

Now write the Custom Function as:

Evaluate ( Whatever ; [FieldA;FieldB])

When I've written it as shown above I get an error message saying "A number, text constant, field name or "(" is expected here." and "FieldA" is indicated by hiliting. Conversely, if I write the function as:

Evaluate ( Whatever; [field1 ; field2] )

i.e. I leave the Evaluate functions default parameters of [field1 ; field2], I get the warning message "The specified parameter cannot be found". This has led me to believe that one of the parameters I've defined can be used.

After going round and round with this I'm to the point of saying, "Hey Moe, hey Larry...".

Any insight into handling this dilemna is greatly appreciated!

I believe this is a result of Filemaker not always making a clear distinction between refering to a field name vs. refering to the field contents.

Evaluate() is a good example - the optional field list is a list of field NAMES. Properly, the syntax should have been Evaluate ( "expression" ; [ "FieldNameA" ; "FieldNameB" ] ).

See if using GetField() might help here.

Hi comment

but this simple calc:

Evaluate ( whatever ; [ fieldA; fieldB ])

evaluates !

Without writhing "fieldA" and "fieldB" !

(If fieldA contains 2 and fieldB contains 3, whatever contains fieldA*fieldB the calc gives: 6)

So I think that Kent_S is right on :)

I don't think we are on the same page.

Suppose you have a text field called Trigger, and a stored calculation field =

Evaluate ( "Get ( CurrentTime )" ; Trigger )

The calc field is going to update every time Trigger is modified.

Now try to make a custom function that will allow the user to enter the formula and the triggering field as parameters.

Something like:

Whatever ( formula ; triggerField ):)

Evaluate ( formula ; triggerField )

But Filemaker will not let you create a custom function like this - because "triggerField" is not a field name.

you said:

Whatever ( formula ; triggerField ):)

Evaluate ( formula ; triggerField )

But Filemaker will not let you create a custom function like this - because "triggerField" is not a field name

It is for this that I was thinking that the guy is right! (isn't this post title:Can't use Evaluate () in Custom Function?)

If FM do not allow, this function can't be used.

Or do you know a way to pass it a valid field name?

I never said he was wrong. I was merely trying to explain why it won't work the way he expects. And no, I don't have a solution for this.

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.