First off, I am a developer for Cognito Forms.
Just to clarify, you want to show a set of checkboxes, with assigned prices, and calculate the amounts as a total for the form, something like this:
If you want to manually calculate a total based on the selections, you can use the following calculation (which is tricky, btw):
=Choice.Count(it = "First Choice") * 1.00 + Choice.Count(it = "Second Choice") * 2.00 + Choice.Count(it = "Third Choice") * 3.00
However, this is definitely not obvious, nor easy, so we have been working to makes things better. In the next release, which is currently in testing, you can configure choice fields as follows:
By selecting Collect Payment For This Field, you can then specify prices for each choice. These selections automatically add to the amount due and optionally can appear as separate order line items. This release will also support tightly integrated Stripe payment, so the order form example above would become:
Hopefully, these changes will support your needs and make things much easier!
I am a developer for Cognito Forms.
The example you included was from this blog post on three ways to implement discounts in Cognito Forms.
The syntax for the discount calculation would be:
=CouponCode = "CODE1" ? 0.15 : CouponCode = "CODE2" ? 0.25 : 0
The syntax is a bit cryptic (used by JavaScript and other C languages), but generally it is:
[condition] ? [true result] : [false result]
But you can chain them together indefinitely like:
[condition 1] ? [true result 1] : [condition 2] ? [true result 2] : [condition 3] ? [true result 3] : [false result]
The full documentation for calculations can be found on the Cognito Forms help site.
Best Answer
Your calculation field,
TotalPayrollHours
, is a numeric calculation, but the type of the calculation field is set toText
. Just change the type of this calculation field toNumber
and yourDailyLaborTotal
calculation will work correctly.