I have 10 things(eg.) which has a common service called fun1() which outputs Infotable as result by making an external API call.
I would like to union the infotable results from all the 10things fun1() call finally.
Instead of looping through each thing and waiting for the output, I would like to run them in parallel as the output is independent of each other and finally once we get the result of all i have to union them to give one result.
What is the best approach in Thingworx.
Solved! Go to Solution.
You could do it by having each of those services set some value in a property besides perhaps placing the retrieved value in another property.
Then have a property data change event into a subscription to evaluate if all services finished to then pick up and stitch the final output together.
This does mean it is happening asynch and you have to use something else then to pick up the final output.
Since the no. of things which is going to call the API is dynamic, meaning it can go to more than 20 too sometimes. And the results(Infotable) have to combined and shown on a grid on the button event from the mashup.
Imagine like user can select 10or20 but the output is one infotable.
So here setting property would not be ideal right.??
Is there no way to know how many calls will be made? Because if you know you can always retain that number for that particular call and use that to gauge if the calls have finished.
After that potentially with yet another data change and a getproperties - push on update - mashup parameter - mashup parameter changed event - retrieve final value could be possible.