Skip to main content
Participant
Apr 2, 2020 10:02 PM UTC
Question

Text Field Properties

How do you create a maximum on a fomula.

Expense sheet

10.00 Breakfast

10.00 Lunch

10.00 Dinner

Max calculation $25.00 

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

try67
Community Expert
Community Expert
Apr 3, 2020 8:42 AM UTC

You need to use a script for that.

Assuming you're adding up those three fields you can use something like this as the custom calculation script of your field:

 

var total = Number(this.getField("Breakfast").valueAsString) + Number(this.getField("Lunch").valueAsString) + Number(this.getField("Dinner").valueAsString);

event.value = Math.min(25, total);

Translate
Apr 3, 2020 9:33 AM UTC

hello

 

Translate
LSDNo1Author
Participant
Apr 3, 2020 2:22 PM UTC

Sorry, I was off for the day. This is all so new to me and yes that is what I want to do, so I tried this and I must have something wrong.



My fields are Bday1, LDay1 and DDay1

and the total field is TotalDay1



So this is what I have however it is not working.



var total = Number(Bday1("Breakfast").valueAsString) + Number(LDay1("Lunch").valueAsString) + Number(DDay1("Dinner").valueAsString);

event.value = Math.min(25, total);

Thank you so much for your help.
[Private info removed]

Translate