Bulk editing point definitions.
-
I was wondering if there was a simple way to get a JSON file of all the points with the same name across a group of datasources. We have 100 data sources that use the same nomenclature and I just want to pluck out one point for all the data sources and do a bulk edit on its point property template field. I can make a watchlist but how do I get a JSON file of the point definitions. Is this even possible. I could take all the JSON for all the points and filter out the relevant stuff in an editor but I was hoping to generate just the points I need.
-
Hi Phillip,
Of course there's a way! How simple is perspective. I would do it like this, using a script input, perhaps the global scripts
var dataPoints = JSON.parse(JsonEmport.dataPointQuery("eq(name,Name Of Point)&limit(1000)")).dataPoints; for( var k = 0; k < dataPoints.length; k += 1 ) { dataPoints[k].templateXid = "NEW_TEMPLATE_XID"; } JsonEmport.setImportDuringValidation(true); JsonEmport.doImport(JSON.stringify({"dataPoints": dataPoints}));
Edit, if you only want the JSON, I would still retrieve that via a script output, like,
print(JsonEmport.dataPointQuery("eq(name,Name Of Point)&limit(1000)"));
If I had my druthers there would be a JavaScript console for this kind of thing, but alas one must validate it in scripts I guess.
-
Cool thanks Phil this seems like just what I need.
-
it did work however I am noticing that the Unit is not stored in the PPT so is there a similar method to set all the units and other point attributes for named groups?
-
Yes, this method of data point editing is just like editing the JSON. So, there is a
unit
field on the data point, we can just assign the unit to it, i.e.var dataPoints = JSON.parse(JsonEmport.dataPointQuery("eq(name,Name Of Point)&limit(1000)")).dataPoints; for( var k = 0; k < dataPoints.length; k += 1 ) { dataPoints[k].unit = "Celsius"; } JsonEmport.setImportDuringValidation(true); JsonEmport.doImport(JSON.stringify({"dataPoints": dataPoints}));
-
Perfect thanks Phil