Example: Workbook Adapter with Lookup

This scenario shows how the Workbook Adapter function type processes the data from the Input Model Table and a Lookup Table. Please note that – although more than one Lookup Table is allowed – only one such table is used for this scenario. Also, you can include additional fields in the result that is calculated through a formula maintained directly in a workbook sheet.

Input

You use this table as an input function

Input Model Table
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

The following table is used as a lookup function:

Lookup Model Table (CAU06)
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

On the Signature tab, you can enter the following data:

Signature Tab
Granularity Selection Action
Customer Customer Total Discount
Product Product  
  Quantity  
  Amount  
You maintain the above fields to perform the following tasks:
  1. 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.

  2. 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.

  3. Add another field used to create a formula which can be included in the final result.

In the Calculation Rules worksheet, there are the Input and Result tabs as well as the Lookup tab that relates to the Lookup Table being connected which is named after its function ID (“CAU06”).

The Input and Result tabs contain the fields maintained in the Signature section. The Lookup tab contains the fields maintained in the Lookup Tables.

Input and Result Tabs
Customer Product Quantity Amount Total Discount
    0 0 0
         
CAU06 (Lookup) Tab
Product Discount Percentage
  0

The table below shows the dummy data for the tabs:

Input Tab
Customer Product Quantity Amount Total Discount
ARR21 SHOES 143 300 0
         
CAU06
Product Discount Percentage
PIPES 90

The formulas shown below are used for the Result tab:

Result Tab
Customer Product Quantity Amount Total Discount
=Input!A2 =Input!B2 =Input!C2 =Input!D2 =(C2*D2)*VLOOK UP(B2,CAU06!A:B,2,0)
By maintaining these formulas, you are cross-referencing the values captured by the first four fields of the Input tab. The additional field Total Discount contains a formula which does the following:
  1. Multiply the value of the Quantity and Amount fields.

  2. Lookup the discount percentage from the Look Up table CAU06 according to the value of the field Product.

  3. Multiply the result of the first two steps.

Output

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 formula created has reference to the input. The additional field (Total Discount) multiplies the product of Quantity and Amount with the discount percentage looked up from the table CAU06.

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.