You can create nested objects by filtering strings. In this example, column headers and column values are nested into a single entity in a new column of Object data type.

Functions:

Source:

The following table shows a series of requests for inventory on three separate products. These are rolling requests, so inventory levels in the subsequent request are decreased based on the previous request.

datereqProdIdreqValueprodAprodBprodC
5/10/21prodA1090100100
5/10/21prodC209010080
5/10/21prodA157510080
5/11/21prodB25757580
5/11/21prodA5707580
5/11/21prodC30707550
5/12/21prodB10706550

You must create a column containing the request information and the inventory level information for the requested product after the request has been fulfilled.

Transformation:

The five data columns must be nested into an Object. The generated column is called inventoryLevels.

You can then build the inventory response column (inventoryResponse) using the FILTEROBJECT function:

Results:

The inventoryResponse column contains the request information and the response information after the request has been fulfilled.

datereqProdIdreqValueprodAprodBprodCinventoryLevelsinventoryResponse
5/10/21prodA1090100100{"reqProdId":"prodA","reqValue":"10","prodA":"90","prodB":"100","prodC":"100"}{"reqProdId":"prodA","reqValue":"10","prodA":"90"}
5/10/21prodC209010080{"reqProdId":"prodC","reqValue":"20","prodA":"90","prodB":"100","prodC":"80"}{"reqProdId":"prodC","reqValue":"20","prodC":"80"}
5/10/21prodA157510080{"reqProdId":"prodA","reqValue":"15","prodA":"75","prodB":"100","prodC":"80"}{"reqProdId":"prodA","reqValue":"15","prodA":"75"}
5/11/21prodB25757580{"reqProdId":"prodB","reqValue":"25","prodA":"75","prodB":"75","prodC":"80"}{"reqProdId":"prodB","reqValue":"25","prodB":"75"}
5/11/21prodA5707580{"reqProdId":"prodA","reqValue":"5","prodA":"70","prodB":"75","prodC":"80"}{"reqProdId":"prodA","reqValue":"5","prodA":"70"}
5/11/21prodC30707550{"reqProdId":"prodC","reqValue":"30","prodA":"70","prodB":"75","prodC":"50"}{"reqProdId":"prodC","reqValue":"30","prodC":"50"}
5/12/21prodB10706550{"reqProdId":"prodB","reqValue":"10","prodA":"70","prodB":"65","prodC":"50"}{"reqProdId":"prodB","reqValue":"10","prodB":"65"}