Discuss

Using Data Transformations in Server Connect

On this page

Data Transformations

Data Transformation options are available in Server Connect. Using them you can easily combine different data sources, add, rename or remove columns from an existing data set. The options available in the Data Transformations are not editing your actual data set, they clone the data and allow you to manipulate it, so your original data source remains unchanged.

You can use the Data Transformations with any collection/array such as - Database Query, API Data Source or any other array. In our example we will show you how to use Data Transformations with an API Data Source.

We created an API Data source, pointing to a custom API:

Screenshot_1|690x429

You can see its results if you enable the output option for this step and run the API Action in the browser:

Screenshot_2|690x429

So that's the data we are working with. We disable the output for the API Data Source step, as we won't need to output the original data, but only the transformed one:

Screenshot_13|690x429

Rename Column

You can easily rename a column returned by your data source. Right click the API Action step:

Screenshot_3|690x429

Open the Data Transformations menu and select Rename Column:

Screenshot_4|690x429

Select your data source:

Screenshot_5|690x429

We select the array element of our API Data Source:

Screenshot_6|690x429

And we click the add new button:

Screenshot_7|690x429

Enter the name of the column from your data source which you want to rename and enter the new name for it:

Screenshot_8|690x429

Enable Output for this step:

Screenshot_10|690x429

Save your API Action, and preview the results in the browser. You can see the new data set containing the renamed column:

Screenshot_12|690x429

Filter Columns

Using the Filter Columns option you can choose whether to show or hide specific columns from your original data set. This is useful when your data source returns many columns, but you need to output or use only a few of them.

Right click the API Data Source step:

Screenshot_14|690x429

Open the Data Transformations menu and select Filter Columns

Screenshot_15|690x429

Select your data source:

Screenshot_16|690x429

We select the array element of our API Data Source:

Screenshot_17|690x429

And open the Filter Columns menu:

Screenshot_18|690x429

In order to remove some of the columns from the data set, just select them from the dropdown:

Screenshot_19|690x429

So this way the selected ones will be removed from the data set:

Screenshot_20|690x429

If you want to keep only the selected columns, then enable the Keep option. In this case only the columns selected in the list will be displayed:

Screenshot_21|690x429

Enable the Output option for this step:

Screenshot_22|690x429

Save your API Action and preview the results in the browser. You can see that only the columns selected in the Filter step are displayed:

Screenshot_23|690x429

Add Columns

Using the Add Columns option you can add columns to the ones returned by your original Data Set.

Right click the API Data Source step:

Screenshot_24|690x429

Open the Data Transformations menu and select Add Columns:

Screenshot_25|690x429

And select your data source:

Screenshot_26|690x429

We select the array element of our API Data Source:

Screenshot_27|690x429

Click the add new column button:

Screenshot_28|690x429

And enter the name of your new column, add a value to it. It can be a dynamic value from your API Action or a static one:

Screenshot_29|690x429

If you want to replace an existing column from your original data set with a new value, then enter the name of the existing column and enable the Overwrite option:

Screenshot_30|690x429

Enable the output for this step:

Screenshot_31|690x429

And preview the results in the browser. You can see the new column is now available in our new data set:

Screenshot_32|690x429

Join

We created a separate tutorial about joining two data sets. You can find it here: https://community.wappler.io/t/join-results-of-2-data-collections/31706