In this section you will learn how to set up some data that you can use in your rules. We will use "inline" data so that this rule application will still be self contained, and not dependent upon external resources. In real world scenarios, it is common to set up use data that will exist in external resources, most likely a database, but could also be an XML document.
- Click on Data in the left-hand navigation panel
- Click Add button and select Table -> Inline Table
- Rename the table from "InlineTable" to "CustomerTable"
- Click the Edit Schema button. Add an entry named "ID" of type integer. Add another entry named "Name" of type text
- Use the Add button to create several entries, where ID is a number (i.e. 1, 2, 3, etc) and the Name is a customer name
- Create another inline table called "ProductTable"
- Use the Edit Schema button again to create three columns. "ID" of type integer, "Name" of the text, and "Price" of type decimal
- Use the Add button to create several entries, where ID is a number (i.e. 1, 2, 3, etc), Name is a product name, and Price is a unit price for that product
- Go back to your Entities, right click on CustName, select Convert To -> Calculation. Set the expression to TableLookup(CustomerTable, "Name","ID",CustID)
- Right click on ProductName, select Convert To -> Calculation. Set the expression to TableLookup(ProductTable,"Name","ID",ProductID)
- Right click on UnitPrice, select Convert To -> Calculation. Set the expression to TableLookup(ProductTable,"Price","ID",ProductID)
- Save the rule application by clicking the Save button in the Quick Access Toolbar
At this point, your Data in the left-hand navigation pane should look like this:
Now, you can move onto the next step, where you will Create Rules