Page tree

Release 9.2


Contents:

Scheduled Maintenance: docs.trifacta.com will be offline for maintenance at 3:00pm UTC on Tuesday March 28 for about 15 minutes.

   

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:

ItemDescription
FILTEROBJECT Function Filters the keys and values from an Object data type column based on a specified key value.
PARSEOBJECT Function Evaluates a String input against the Object datatype. If the input matches, the function outputs an Object value. Input can be a literal, a column of values, or a function returning String values.

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.

Transformation Name Nest columns into Objects
Parameter: Columns reqProdId,reqValue,prodA,prodB,prodC
Parameter: Nest columns to Object
Parameter: New column name inventoryLevels

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

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula filterobject(parseobject(inventoryRequest), ['reqProdId','reqValue',reqProdId])
Parameter: New column name inventoryResponse

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"}

This page has no comments.