Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2688 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

There seems to be a bug with FileMaker Server 16.

Server scripts or scheduled scripts do not work when using the 'Insert Calculated Result' script step as part of a find, but it does on FileMaker Pro.
A workaround is to use the 'Set Field' script step, which is fine, but this bug caused us some issues and will no doubt cause others problems.

Posted

1. Make sure you report it on the official bug report forum: https://community.filemaker.com/community/discussions/report-an-issue/content

2. Why are you using Insert Calculated Result instead of Set Field? Set Field is the default for setting data ( browse or find mode ). Insert Calculated Result requires the field to be on the layout. And in general, "Insert" script steps I've always found to be be, not the most reliable. Set Field does not require the field to be on the layout. I really can't think of any reason to ever use Insert Calculated Result.

A while back, @CobaltSky had mentioned that Insert Calculated Result did not produce a value that match the selected field type ( number, date, text, etc ). And he used this example:

Insert Calculated Result [ Select ; "YourField" ; "(Status(CurrentDate) + 1" ]
Insert Calculated Result [ Select ; "YourField" ; "1 + (Status(CurrentDate)" ]

I'm not entirely sure if this is still true ( I haven't tested it recently ), but the example was to show that these 2 calculations would not produce the same result type. The first would result in a text string. The second would result in a number. Which could cause some strange behaviors and problems with calculations. Set Field does not have that problem.

Posted

jaboda, there are times where Insert Calculated Result[] is valuable.  One example is when using Set Selection[] step and then use Insert Calculated Result[] to insert text at that point.  Set Field[] wouldn't work in that example and there are a few others not coming to me at the moment.  But Josh is correct that it is far more limited than Set Field[].  Can you provide the calculation and how you are using it?

Posted

That is a good example. Thanks LaRetta. Typically in those scenarios, I pull the value into a variable slice it and glue it back together. But Insert Calculated Result would probably be a touch easier.

 :pounce:

Posted

Yes, another example is:

Insert Calculated Result [ TextSize ( Middle ( Get ( ActiveFieldContents ) ; Get ( ActiveSelectionStart ) ; Get
( ActiveSelectionSize ) ) ; 24 ) ] 

It certainly has its value when the User is on a layout.  Also, Insert Calculated Result[] can paste its result into the current field in the current record or into a variable.  It would help to know specifically the script and calculation jaboda used that fails.  It is probably because the field isn't on the layout.

Posted

The reason I was using Insert Calculated Result is because it was an old script written 9 years ago which was working fine.

This is what I was using:

Go to Layout [ “Event Log Table” (Event Log) ]
Enter Find Mode [ ]
Insert Calculated Result [ Event Log::Date; "<" & Get ( CurrentDate ) - 90 ]
[ Select ]
Perform Find [ ]
If [ Get ( FoundCount ) > 0 ]
Delete All Records
[ No dialog ]
End If

I have since changed it to Set Field and it works fine again.

I have not tried this on 16.0.2.

Posted

Nothing there is version specific, so it will work fine in 16.0.2.

Posted
5 minutes ago, Josh Ormond said:

Nothing there is version specific, so it will work fine in 16.0.2.

It didn't work on 16.0.1, but did on 15 which suggests a bug.

Posted

I've just tested it with a clean database (see attached) and it works correctly on 16.0.2.

So I'm assuming this was a bug specific to 16.0.1...

FileMaker Server Bug.zip

  • Like 1
Posted

I've got a support case open with FileMaker.

Posted (edited)

It does sound like a possible 16.0.x issue. Just thought I'd add: it makes sense that this was an old script. In old versions of FileMaker, you had to use Insert script steps for those kind of calculated strings in Find mode -- Set Field wouldn't work. I don't recall exactly when this changed, but for some years we've been able to use Set Field this way, which is generally preferable for the reasons Josh mentioned earlier.

Edited by Fitch
Meant to say 16.0.x (vs. 16.01)
Posted

Hi Jaboda,

On 7/12/2017 at 4:51 AM, jaboda said:

9 years ago which was working fine.

That fits the timeline as I remember it.

Prior to the release of FileMaker Pro 8, using the Insert Calculated Result ( ) was the only way we could use a date in a script or calculation. There was also a Today Function back then, which was eliminated in version 8. I'm not positive, but I believe that was when we could use Get (CurrentDate) in the Set Field Function.

Lee

I thought I had sent this yesterday.:(

This topic is 2688 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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