Is it possible to populate a same table with data from two External API variables?

1
0
-1

Using API routes in the UI Designer, I have set up two variables containing the properties of two types of tasks: pending and completed. Each of the variables currently displays its contents in a separate table. Since both tables represent properties from the same kind of data, a task, they both have the same fields as column keys: caseId, displayName, state, assigned_date and priority.

All these properties are present in both humanTask and archivedHumanTask, so I was thinking that perhaps they could be "compatible" with eachother. To sum it up, I was wondering if it would be possible to merge both tables into one, making it display the data from both the Tarea and the TareaCompletada variables (humanTask and archivedHumanTask, respectively), and most importantly, how could I do this.

Please, if you've any doubts about my question, don't hesitate to comment and I'll try to provide a clearer explaination.

Regards, and thanks in advance,
Daniel.

1 answer

1
+1
-1
This one is the BEST answer!

Hi Daniel,

since each variable is an array, you could define a third variable called TareaTotal of type Javascript Espression and then in the value field you write this script:

return $data.Tarea.concat($data.TareaCompletada)

Then, you will use the variable TareaTotal on the field Content of the Table Widget.

I tried the same with two array obtained from two different API call

Comments

Submitted by daniel_1417698 on Tue, 02/04/2020 - 09:24

Excellent, this is just what I needed! I tried it out and it correctly displays the contents of both variables as long as the names of their fields match. Thanks!

Notifications