cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Multiple selection list call a single service that gets data for each of the selected Things

AinhoaH
4-Participant

Multiple selection list call a single service that gets data for each of the selected Things

We don’t know how to develop the following in a mashup. We have a multiple choice drop down list with different items that represent a Thing on the platform and we’ll like to call a single service that gets iteratively all the data for each of the selected items to represent them on a time series chart widget. 

Currently, we’ve developed one service for each of the selected items and we call them one by one, but we understand this is not the way to do it. We’ve developed 4 different services and this way we can visualize data for a maximum of 4 different Things selected on the list, but we have 70 different item to select for.

Thanks in advance,

4 REPLIES 4

Hello,

 

The service that provides the content for your list, it has "Selected rows". What you need to do is bind this "Selected rows" to some input parameter of type INFOTABLE of the service which processes selected data. This way, if the user selects several items in the list, this INFOTABLE will contain only those items, and you'll be able to process them in the second service.

 

/ Constantine

AinhoaH
4-Participant
(To:Constantine)

Thanks for the quick reply. 

 

We already have those "selected rows" as input parameter of our service, but we want to iterate through them and call a service that gets the data for each of them to visualize all of the results in the same time series chart.

Each of the selected item from the list is a Thing and it has to be a datasource and in the time series chart we only display one property of the Thing.

 

Thank you, 

 

Hello,

 

I would suggest you to iterate through those selected rows inside that service and aggregate results, something like that:

 

var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
    infoTableName : "InfoTable",
    dataShapeName : "MyDataShape"					// TODO: Use correct data shape name
});

for (var i = 0; i < selected.rows.length; ++i) {	// TODO: "selected" is the input parameter
    var row = selected.rows[i];
    var r = me.ProcessRow({ row: row });			// TODO: Use correct service name
	result = Resources["InfoTableFunctions"].Union({ 
        t1: result, 
        t2: r 
    });
}

 

/ Constantine

AinhoaH
4-Participant
(To:Constantine)

Hi, 

 

To get the info for the Things selected on the list, we're using the service "getQueryNumberPropertyHistory" and the answer doesn't have the Thing name, so how can we know the Things name to display the data in the time series chart using the "union"? I attach a screenshot of the mashup for you to understand what we're trying to achive.

 

thanks very much,

Top Tags