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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Export to csv through service

asekar
13-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
mnarang
17-Peridot
(To:asekar)

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 .

View solution in original post

3 REPLIES 3

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.

mnarang
17-Peridot
(To:asekar)

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 .

asekar
13-Aquamarine
(To:mnarang)

Thank you. This worked

 

Arvind

Top Tags