In many situations requiring custom calculations it is necessary to use a spreadsheet pricing engine, to allow for using calculations on different result values in the pricing calculator, such as price or weight, or for custom option calculations, it is possible to use calculations that will apply to the quantity (Q1, Q2, Q3, Q4 and Q5) values in a price engine.
In the example below, a calculation on the Applies To column in the calculator row is used to reference an option from the pricing grid above the calculator row.
ifn(G1=”100# Cover”, Q1, -1)
If the option "UV Coating (Cover Stock Only" is set to Yes, the Paper Stock Option must be "100# Cover", otherwise a calculation error is returned because the statement returns a value of -1, which produces an error from the pricing engine. If the Paper Stock Option matches "100# Cover", the Q1 quantity value is returned for the calculation.
Note that there is no ability to customize the error message that is shown when the -1 value is returned from the calculator row. The pricing engine will just show a generic error if an invalid option is selected. When testing the price engine, the error will show as in the screenshot below, just indicating that a combination of choices is not allowed.
It is not possible at this time to have custom error messages generated from pricing engines. This example just forces the default error code by having a calculation that results in a negative value, which causes the error to show.