Skip to content

Data Pivot

Data Pivot is a versatile tool in Nappai that helps you restructure your data. Think of it as a translator between two different ways of organizing information: a single detailed record (an “Object”) and a list of individual rows (a “Table”).

You can use this component to take a complex piece of data and break it down into a simple list for easier viewing, or take a list of items and combine them back into a single structured record. This is very useful when you need to prepare data for a report, feed it into another system, or simply change how it looks in your dashboard.

How it Works

The Data Pivot component works by analyzing the structure of your input data and applying a transformation based on your settings. It operates in two main directions:

  1. Object to Rows: It takes a single data record (like a contact profile with name, email, and address) and breaks it apart. Each piece of information becomes its own row in a list. This is great for creating tables or lists where you want to see each attribute separately.
  2. Rows to Object: It does the opposite. It takes a list of rows and combines them back into a single, cohesive record. This is useful when you have gathered information in a table format and need to save it back as a structured object.

The component handles the logic of matching keys (like “Name”) to values (like “John Doe”) automatically, ensuring that no data is lost during the transformation.

Connection & Credentials

This component does not require any external credentials or API connections. It processes data locally within your workflow.

Inputs

The following fields are available to configure this component. Each field may be visible in different operations:

  • Transform Mode: Choose how to transform your data. Use “Object to List” to break a single record into rows, or “List to Object” to combine rows back into a record.
  • Data: The data to transform. For ‘Object to List’: provide a single object. For ‘List to Object’: provide a list of row objects.
  • Key Column Name: Name for the column that will contain the original field names (keys). This is the first column.
  • Value Column Name: Name for the column that will contain the field values. This is the second column.
  • Format Labels: How to format the key names when creating rows.
  • Include Header Row: Add a header row at the beginning showing the column names. This makes the result easier to read in tables.
  • Wrap List in Object: When enabled, the converted list will be returned inside an object with a ‘data_list’ key instead of as a direct list. This is useful if the next step in your workflow expects a specific object structure.

Outputs

The component produces the transformed data in the Output field.

  • Output: The resulting data. If you chose “Object to List,” this will be a list of rows. If you chose “List to Object,” this will be a single combined object. You can connect this output to other components that need this specific format of data.

Output Data Example (JSON)

Example of a successful “Object to Rows” transformation:json [ { “Key”: “Name”, “Value”: “Alice Smith” }, { “Key”: “Email”, “Value”: “alice@example.com” }, { “Key”: “Role”, “Value”: “Admin” } ]

Example of a successful “Rows to Object” transformation:json { “Name”: “Alice Smith”, “Email”: “alice@example.com”, “Role”: “Admin” }

Connectivity

This component typically connects to data preparation or formatting stages in your workflow.

  • From: Previous components that provide raw data, such as database connectors, API fetchers, or manual data entry inputs.
  • To: Components that require tabular data for reporting, spreadsheet exports, or further row-by-row processing. It can also feed into components that expect a structured JSON object, such as API posting tools or database updaters.

Usage Example

Scenario: You have a user profile stored as a single object, but you need to display each attribute in a table on your dashboard.

  1. Connect your User Profile Object to the Data input of the Data Pivot component.
  2. Set Transform Mode to “Object to List”.
  3. Set Include Header Row to “Yes” to make the table readable.
  4. The Output will now be a list of rows. Connect this output to a Table Display component to visualize the data in columns and rows.

Tips and Best Practices

  • Use Include Header Row when you plan to display the data in a table or export it to a spreadsheet; it makes the data much easier to read.
  • If the next component in your workflow complains about receiving a “List” instead of an “Object,” try enabling Wrap List in Object to fix the structure.
  • Ensure your input data is consistent. For “Object to List,” the input should be a single dictionary. For “List to Object,” the input should be a list of dictionaries.

Security Considerations

This component processes data locally and does not transmit any data to external services. However, ensure that the data you are transforming does not contain sensitive information that you do not want to expose in your dashboard or logs.

This component is often used in conjunction with:

  • Data Formatting: For further cleaning or styling of the data after pivoting.
  • Table Display: To visualize the pivoted list of rows in a grid view.
  • Data Store: To save the restructured data for later use.

Important Notes

There are no specific critical notes for this component. Standard data handling rules apply.

Security Considerations

No specific security risks are associated with this component as it performs local data transformation. Always ensure your source data is secure.