Example: Workbook Adapter with Import
This scenario shows how the Workbook Adapter function type processes the data from the Input Model table and an imported local Excel file. Also, it allows for additional fields to be included in the result that is calculated through a formula maintained directly in a workbook sheet.
Input
You use this table as an input function:
| Customer | Product | Quantity | Amount |
|---|---|---|---|
| CUST01 | PROD05 | 15 | 62.50 |
| CUST02 | PROD04 | 89 | 250.00 |
| CUST03 | PROD03 | 99 | 206.25 |
| CUST04 | PROD02 | 112 | 132.50 |
| CUST05 | PROD01 | 55 | 20.00 |
On the Signature tab, you can enter the following data:
| Granularity | Selection | Action |
|---|---|---|
| Customer | Customer | Total Discount |
| Product | Product | |
| Quantity | ||
| Amount |
-
Enter the fields Customer and Product in the Granularity column as they contain unique data records. This way, you make sure that the system processes data records from the input data in a grouped manner. In addition, you ensure that the system considers all records from the input function for processing.
-
Make sure that the fields Customer, Product, Quantity, and Amount (which can also be seen in the Input Model Table) are included in the result table.
-
Add another field used to create a formula which can be included in the final result.
In the Calculation Rules worksheet, there are two tabs (Input and Result). They contain the fields maintained in the Signature section.
Perform Import
-
On the expanded Workbook screen, choose the File button located at the upper left of the workbook.
-
The system displays a new screen. Choose Import.
-
Depending on the type of the file to be imported, choose either Excel File or CSV File in the Import section of the screen. Then choose Import Excel File or Import CSV File (depending on the selected file type).
-
Select the required import file.
In this example, the data is imported from the following locally saved Excel file:
| Product | Discount Percentage |
|---|---|
| PROD30 | 0.01 |
| PROD29 | 0.02 |
| PROD28 | 0.03 |
| PROD27 | 0.04 |
| PROD26 | 0.05 |
| PROD25 | 0.06 |
| PROD24 | 0.07 |
| PROD23 | 0.08 |
| PROD22 | 0.09 |
| PROD21 | 0.1 |
| PROD20 | 0.11 |
| PROD19 | 0.12 |
| PROD18 | 0.13 |
| PROD17 | 0.14 |
| PROD16 | 0.15 |
| PROD15 | 0.16 |
| PROD14 | 0.17 |
| PROD13 | 0.18 |
| PROD12 | 0.19 |
| PROD11 | 0.2 |
| PROD10 | 0.21 |
| PROD09 | 0.22 |
| PROD08 | 0.23 |
| PROD07 | 0.24 |
| PROD06 | 0.25 |
| PROD05 | 0.26 |
| PROD04 | 0.27 |
| PROD03 | 0.28 |
| PROD02 | 0.29 |
| PROD01 | 0.3 |
After the import, the calculation rules are filled with the data from the imported Excel file. The Input and Result tabs are still intact.
| Customer | Product | Quantity | Amount | Total Discount |
|---|---|---|---|---|
| 0 | 0 | 0 | ||
The table below shows the dummy data for the tabs:
| Customer | Product | Quantity | Amount | Total Discount |
|---|---|---|---|---|
| ARR21 | SHOES | 143 | 300 | 0 |
The formulas shown below are used for the Result tab:
| Customer | Product | Quantity | Amount | Total Discount |
|---|---|---|---|---|
| =Input!A2 | =Input!B2 | =Input!C2 | =Input!D2 | =(C2*D2)*VLOOK UP(B2,'Discount Percentage'!A:B,2,0) |
-
Multiply the value of the Quantity and Amount fields.
-
Look up the value from the Discount Percentage table (the data from the imported file) according to the data in the field Product.
-
Multiply the result of the first two steps.
Final Output
| Customer | Product | Quantity | Amount | Total Discount |
|---|---|---|---|---|
| CUST01 | PROD05 | 15 | 62.50 | 243.75 |
| CUST02 | PROD04 | 89 | 250.00 | 6,007.50 |
| CUST03 | PROD03 | 99 | 206.25 | 5,717.25 |
| CUST04 | PROD02 | 112 | 132.50 | 4,303.60 |
| CUST05 | PROD01 | 55 | 20.00 | 330.00 |
The first four fields (Customer, Product, Quantity, and Amount) just capture the data from the Input Model Table because the created formula has reference to the input. The additional field (Total Discount) multiplies the product of Quantity and Amount with the value looked up from the Discount Percentage table (the data from the imported file).
In this example, only one line of formula has been created. In any way, the function considers all records from the input function for processing because the fields have been maintained in the Granularity fields from the Signature section.