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

Export to csv through service

SOLVED
Highlighted
Aquamarine

Export to csv through service

I have a Thing and valuestream associated to that. Have made properties of that thing logged and persistent so that I can use valuestream for time series. I'm able to get the same in a mashup.

 

If I wanted to write a service which will perform the same function as an export widget in a mashup, I would be able to invoke service every x mins to export the property history to csv

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Export to csv through service

Or else you can try using the service "WriteCSVFile" from available snippet .It is like this -

var params = {
 path: undefined /* STRING */,
 data: undefined /* INFOTABLE */,
 fileRepository: undefined /* THINGNAME */,
 withHeader: undefined /* BOOLEAN */
};

// no return
Resources["CSVParserFunctions"].WriteCSVFile(params);

 

It takes data as an infotable which will be coming from the "QueryPropertyHistory" so you can pass that infotable to this service and write this to CSV in repository .

3 REPLIES 3

Re: Export to csv through service

Hello, I think you could use the service in Data Export Extension, the entity it includes have service to help infotable exported as CSV file.

Re: Export to csv through service

Or else you can try using the service "WriteCSVFile" from available snippet .It is like this -

var params = {
 path: undefined /* STRING */,
 data: undefined /* INFOTABLE */,
 fileRepository: undefined /* THINGNAME */,
 withHeader: undefined /* BOOLEAN */
};

// no return
Resources["CSVParserFunctions"].WriteCSVFile(params);

 

It takes data as an infotable which will be coming from the "QueryPropertyHistory" so you can pass that infotable to this service and write this to CSV in repository .

Re: Export to csv through service

Thank you. This worked

 

Arvind