Working with Connector outputs

You are now aware of the different connectors that you can use to integrate the functionalities of other services like Slack, Trello, as well as Databases like MySQL, Postgres and so on to enhance the functionalities of your apps. The data can be fetched from these connectors when you need the data in your actions flows and workflows that are triggered on the happening of an event. If the output of the selected connectors is from an array path then you would get the output as an Array. Now typically in the Action flows you may want to use a single value operation. In such cases if you are getting an array output you can make use of functions like the INDEXVALUE to fetch single values for your operations within the Action flow and workflows. You can make use of the Action Output and define your further operations accordingly.

Connector Outputs

Action output as Array

Now let us consider an example here of a MongoDB Connector to fetch data from one of the Author collections. We would enter the Initials of the authors to fetch the data for and display it in the dropdown button on click of the Action button. So now let us configure the Action flow. Here we will be passing the initials accepted from a text box control as the parameter for the connector.

The connector output would be assigned to the variable defined as response to this particular action.

Now let us set the Dropdown control’s value using the Action output.

The Action output is an array and hence you can see here that the values are assigned to the Dropdown control as the list items.

Similarly if you are using the API Connectors and accessing keys inside a JSON array, then output will be an array.

Action Output as Single value

Now we have seen in the above example that the action output is an array. Let us take another example to find the top author from the list. In that case it is a single value that you need. So here where you are getting an Array as output you can then make use of the INDEXVALUE function to fetch a specific record from the Action output. In this example let us display the top author in the Text control on click of the Action Button. In the above example we have used the Array output as it is in the set control value. However now you want to use a formula in the task. However it is not possible to use the functions or formulas in these tasks like the Set Control Value directly. So you would need to use the Compute task to derive the single value from the data. In the Compute task assign the value to the variable using the INDEXVALUE(“connectortask.responsevariable”, 1) function.

This value can be then set using the Set Control Value task. It would be set for the text control in the example “actionname.variable”, where the actionname is the Compute action.

You can thus make use of such functions like the INDEXVALUE() to use only a single value from the Array.

Thus you can see the two different Action outputs and the way you can make use the functions to get data as required.