Jump to content

Minimum charge script not working as needed


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

Recommended Posts

  • 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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 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!

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 3255 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.