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.

Minimum charge script not working as needed

Featured Replies

  • Newbies

Hello,

I am setting up a production/labor tracking database for our printing plant. The users in our various departments are to log in and record their labor time using the portal display. I have one layout for each department that has a start time and a stop time function. The prepress department portal needs to have a minimum time on the first in/out record if the actual labor is less than 25 minutes. I have attached a script that works correctly only if the user is under 25 minutes on the first record. I the user works over 25 minutes the record still shows 00:25:00. I have set the attached script to function "On Record Commit" in the prepress layout.

Pre-Pres Minimum Charge.JPG

Note that if you're accessing the first related record, you don't need a portal. Also, you can simplify the script to one line:

Set Field [
Target field: AllData::prePressTotal
Specify result:
Max ( 
 
AllData::prePressTotal ;
  Time ( 0 ; 25 ; 0 )
  )

]

Edited by eos

  • Author
  • Newbies

Hello,

I only need a minimum value for the first record. The additional records are correct as is.

The suggested script is not showing the minimum "00:25:00" value. The "prepresslinetotal" field is showing just that actual time entered.

I tried with and without the "Go To Portal" and "Go To Field" steps, no effect on the calculation.

I tried to use "Min" function with the same results.

Thank you for your help!

 

 

Is your total field a calculation field? You cannot set such a field field, neither manually nor via script.

Instead, use a regular number field with an auto-enter calculation; if you know beforehand which record is the first one, you could continue to use a calculation, but one that returns the Max() of the duration (stop-start) or 25 Mins. 

See the attached sample file.

Maximum_eos.fmp12.zip

The second Set Field step in your script (after the Else If) will not work as the field to be set is not specified, only the result to be posted. On the other hand, see comments above if the target field you intend to be set is in fact a calc field.

Without a specified target field, the target field is the currently active one (if any).

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.