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.

Calculated Field Server Script Issue

Featured Replies

Hi

I have a calculated field that successfully returns a value when accessed via a script run on the client, however when the same script is run as a FM Server(8) script, it is not returning values.

The calculated field is unstored and performs an aggregate function based on a TO relationship (simply, count the number of siblings of this parent).

Again, when I run this on the client it works, but as soon as it runs on the server the calculated field returns nothing.

FYI the script is running in one database and is accessing the parent table and sibling in another database. There are custom functions installed but these are not being referenced in the calculated field.

Am I missing something, like calculated fields don't work when accessed via server scripts, or not in server scripts when they access tables outside of their database?

Any help would be greatly appreciated.

Many thanks.

"Siblings of a parent" Hmm. That's a bit odd. Parents have children, but siblings?

Could you provide us with actual field names and tables?

Are there any global fields involved that aren't being set when the server runs this script?

Please post your script or better yet a copy of the file.

  • Author

Siblings! What was I thinking? I meant to say children.

I would upload the original files but they are very large (this db has been in operation for years). So I tried to replicate the problem by setting up a small example db and guess what ... this work fine, the script runs fine on the client AND the server!

The only immediate difference I can see is that everything is contain in this one example db file, whereas the real environment is 3 separate db files.

I have attached this example db, but of course it works! However if you can see any likely cause for the problem I would appreciate your comments.

(If you are wondering why all of this is being done it is because we have 6000 customers and 30000 jobs, and having unstored calculations to aggregate data is causing performance issues. We are happy to live with a daily snapshot of this summary data).

Thanks for taking the time to help.

Regards

Tim

example.fp7.zip

  • Author

I am pleased to say this has been resolved.

There was nothing wrong with the field definitions nor TO relationships. The issue was file references. For whatever reason, whilst file references using fmnet work from the client, they were not working from the server.

Making these relative fixed the issue for the server script and has had no detrimental effect for the clients.

Tim

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.