Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Previous Section | Next Section

...

Update the Client Information Form

  1. Click the Action Menu and select  Duplicate to make a copy of the Order Info form. Then, click the name of the new form to open the Form Designer.
  2. In the Properties Panel, change the form name to Order Info Rules.

...

  1. Click Rules in the Guided Designer Navigation bar at the top of the page. 
  2. Click Create a new rule.
  3. Change the name of the rule to: Initialize form
  4. Click on the Rule Builder button.

    1. Click Next to go to the Action wizard.

    2. The first action appears by default. If needed, click the Add Action button on the top right of the Action Wizard

    3. Select TodaysDate from the first dropdown. TodaySDate is the Name of the Date control at the top of the form. If your control is named something else, select that control from the dropdown.replace TodaySDate below with that name

    4. Select to from the second dropdown

    5. Type today in the Expression field and click on the today function when it displays in the dropdown 

  5. Click Finish.

  6. Save and Test. Now, when the end user first starts using the form, the Date control at the top will be set to today's date. No need for the user to type it in.

    Expand
    titleClick here to see this rule in the Visual Rule Builder

...

  1. Click Form in the Guided Designer Navigation barn to return to the form. In the Order Items table, select the Price column by clicking on the header. In the Properties panel, uncheck Enabled. The entire column is grayed out.
  2. Go back to the rules editor, create a new rule and edit it. Change the name of the rule to: Set Price Chevrolet
  3. Run Builder. On the Condition wizard:
    1. Select the control 'Item'
    2. Select the operator 'Is'
    3. Click the toggle to switch to a Literal Value, and type Chevrolet.
    4. Click Next
  4. On the Action wizard, set the control 'Price' to the literal value '125.75'
  5. Click Finish. Your rule should look like this.

  6. Repeat Steps 2-5, creating two more rules. 
    1. When Item is Chrysler, Set Price to 118.75
    2. When Item is Ford, Set Price to 132.75

Save and Test your form. Now, when the user selects an item, the price for that item will be displayed.


Info

frevvo rules also support JS custom code.


Expand
titleClick here to take a quick look at an example of the above Set Price rules in javascript.

Click Rule Code then click Edit Code. In the Rule area, type or copy/paste the following. 

Code Block
languagejavascript
linenumberstrue
for (var i = 0; i < Item.value.length; i++) {
  if (Item[i].value === 'Chevrolet') {
    Price[i].value = 125.75;
  } else if (Item[i].value === 'Chrysler') {
    Price[i].value = 118.75;
  } else if (Item[i].value === 'Ford') {
    Price[i].value = 132.75;
  }
}

...

  1. Click Form  in the Guided Designer navigation bar to return to the form. In the Order Items table, select the Subtotal column by clicking on the header. In the Properties panel, uncheck Enabled. The entire column is grayed out.
  2. Go back to the rules editor and create a new rule. Change the name of the rule to: Calculate SubTotals
  3. Click on the Rule Builder button. You will see the Condition wizard

    1. Select your Price control from dropdown

    2. Select the "is filled" property from the Property dropdown
    3. Click Next to go to the Action wizard.

    4. Select your Subtotal control from the dropdown.

    5. Select "to" from the second dropdown

    6. Type Price * Quantity in the Expressions field

  4. Click Finish then  save  save and test. Now, when the end user selects the item and fills in the quantity, the Subtotal will be calculated for each row of the table

...

  1. Click Form  in the Guided Designer navigation bar to return to the form. Click on the Grand Total control. Uncheck Enabled in the Properties panel. The field is greyed out.
  2. Go back to the rules editor, create a new rule and edit it. Change the name of the rule to: Calculate Grand Total
  3. Click on the Rule Builder button. You will see the Condition wizard

    1. Click Next to go to the Action wizard.

    2. Select your Grand Total control from the first dropdown.

    3. Select "to" from the second dropdown

    4. Type sum in the Expressions field and click on the sum function when it displays in the dropdown 

    5. Select the Subtotal field from the dropdown then add the closing parenthesis

  4. Click Finish then  save  save and test.

Expand
titleClick here to see this rule in the Visual Rule Builder

...