How to flag that a height selection or width selection is out of the range of a piece of equipment. For example, our photopolymer developer can handle sheets up to 17.5 x 24 inches. The object is to have the pricing form prevent a user from entering dimensions which can not be produced. This code is for use when there is a limit to both height and width. For additional discussion on validating User Input see how-to_validate_a_users_input

The concept is to flag the mistake at the time the product is created in the estimate or work order by using the cfl_reference logic and Error Trapping capabilities of the pricing form. The purpose is to provide some simple generic code which a user can modify to create an error check or trap of his choosing.

It is important to test all variations of possible entries as the user will not be able to exit or save the form if there is a mistake in the formula. One user has made an excellent suggestion that all Product Error code should first be tested in the pricing_ch_03-products section to be sure it is working correctly.

1. Determine the Height and Width variables which are used in the pricing form for which you are creating this error message. In this case the variables are named PolymerHeight and PolymerWidth. To have the formula work, the code must match the settings in the "Units For Entering Values" selection in the Variable Setup form. For example, if the Variable is set to "Length" and the "Units for Entering Values" is set to "Inch", then you must follow the number limit with "Inches" as shown below. If the Unit Type is set to "None" and the Unit For Entering Variables and the Unit For Displaying Variables is set to "None", you do not follow your number with this qualifier.

2. Determine the measurements you wish to set for each dimension. Substitute those for the 17.5 and 24 which you see below.

3. Write or paste the formula in the code below in the[[pricing_ch_03-products]] formula checker box in the pricing form. Note that you may need to click the little blue down arrow to open the form. Click on the big raised bar to the right of the form labeled "[[how-to_make_coding_easier_with_the_formula_builder]]r" to open the form to take advantage of the CFL error checking logic. If you want to have your message spread over several lines, then use a carriage return (Enter) and Cyrious will present it as you have typed it, as long as the entire message is contained within one set of quotation marks. If you see "Formula OK" message at the bottom of the form, then you probably have it correct. Click OK to exit the form and then click Save the product and you now should have the error trap. Note that in a multi-user environment this may not take effect on other machines until the users restart their Cyrious program.

code format="delphi"

Make sure the smallest side is smaller than the smallest dimension (17.5 inches) and the largest side is smaller than the large dimension (24 inches)

Declare OneSideTooBig :=

   (MIN(PolymerHeight, Polymerwidth) > 17.5 inches)
    OR  (MAX(PolymerWidth, PolymerHeight) > 24 inches);

Declare SizeMessage := “Maximum Dimensions for Polymer are 17.5 x 24 inches.” ;

IF OneSideTooBig THEN SizeMessage ELSE “” ENDIF;

<code> 4. Test your new error trap with every possible dimension in both height and width to be sure that it is working correctly.

  • Contributor: Steve Gillispie , Acorn Sign Graphics
  • Date: 07/08/2009
  • Version: Control 4.3
You could leave a comment if you were logged in.