 Connect as formula reference The gadget spec URL could not be found
"Connect as formula reference" is used for connecting two models where a direct relationship does not exist. In such a case, the connection is made possible through a common model that is related to both of these models. The example application that we are building currently does not necessitate a connection of this type. To help understand this type of connection, we will make a minor change to the functional requirements of the example application.
Let's say we want to offer certain products at a discounted price e.g. end-of-season sale. To this end, we will have to maintain promotion details (promotion code, discount) and associate a promotion code with the product that has a promotional offer. When creating an order, we have to look up the discount from the promotion details for the product being ordered and apply that discount to the product price. The data model diagram for this has been presented below for reference. We can see that no direct connection exists between product orders and promotion details, but it is connected through the common model product details. In this case, connection must be established using "connect as formula reference".
Alternatively, if a formula written in a cell returns SheetID of an instance, the data from that instance can be fetched by first creating a formula reference using the connect option, and then using that reference to fetch the required data. Let's implement a formula reference in the example application. The CustomerOrders data model contains the min and max item price in an order. To determine the product code of the item with min and max price, we will have to do a search on the product model.
Use formula reference to establish the connection between "ProductOrders" and "Promotion"
First, determine the SheetId of the instance that corresponds to the item with min price.
|
|
Select the private cell (A5). Enter the following rule in the cell.
=DSEARCH(Product.ProductPrice= Min_Item_Price) |
|
|
|
The namebox shows the name of the private cell (A5). The formula bar shows the corresponding rule.
The database function "DSEARCH" has been used to search the product model.
|
|
Similarly, determine the SheetId of the instance that corresponds to the item with mac price.
|
|
Select the private cell (B5). Enter the following rule in the cell.
=DSEARCH(Product.ProductPrice= Max_Item_Price) |
|
|
|
The namebox shows the name of the private cell (B5). The formula bar shows the corresponding rule.
The database function "DSEARCH" has been used to search the product model.
|
|
Establish a formula reference connection between the ProductOrders and Product model.
|
|
Select the private cell (A5). |
|
|
|
|
Click on the "Connect" icon. |
|
|
|
Select the "Formula Reference Cell" option. |
|
|
|
"Reference Cell Connection Wizard" will be displayed.
|
|
|
|
Select "Product" model from the list of data models.
|
|
|
|
Select "SheetName" as the display cell.
|
|
|
|
Clcik on the "Create" button.
|
|
|
|
|
|
|
A formula reference has been created for the private cell.
|
|
|
|
Click on the "OK" button.
|
|
|
|
The private cell (A5) can be used as a reference cell to fetch any data values from the "Product" data model.
|
|
|
|
|
|
Establish a formula reference connection between the ProductOrders and Product model.
|
|
Select the private cell (B5). |
|
|
|
|
Click on the "Connect" icon. |
|
|
|
Select the "Formula Reference Cell" option. |
|
|
|
"Reference Cell Connection Wizard" will be displayed.
|
|
|
|
Select "Product" model from the list of data models.
|
|
|
|
Select "SheetName" as the display cell.
|
|
|
|
Clcik on the "Create" button.
|
|
|
|
|
|
|
A formula reference has been created for the private cell.
|
|
|
|
Click on the "OK" button.
|
|
|
|
The private cell (B5) can be used as a reference cell to fetch any data values from the "Product" data model.
|
|
|
|
|
|
Use the formula reference cell to determine the product code of the item with min and max price.
|
| Select the private cell (A6). Enter the following rule in the cell.
=A5.ProductCode
Similarly, enter the following rule in the private cell (B6). |
|
|
| The namebox shows the name of the private cell (B6). The formula bar shows the corresponding rule.
|
|
|
|