Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi,
I am trying to purge value streams for two properties. But getting the Null pointer exception after executing the following code:
var params = {
propertyNames: { "items": ["propA", "propB"] }
};
// result: INFOTABLE dataShape: "undefined"
var namedProperties = me.GetNamedProperties(params);
var paramsForPurge = {
propertiesToPurge: namedProperties /* INFOTABLE */,
endDate: Date.now(),
startDate: new Date(new Date().setFullYear(new Date().getFullYear() - 1))
}
me.PurgeSelectedPropertyHistory(paramsForPurge);
What I am doing wrong?
Hi Boris,
Please check if the GetNamedProperties service returns the correct property names (without the values).
Or try using the PurgePropertyHistory service to purge the properties one by one and let me know if you are still getting the Null Pointer .
var params = {
propertyName: "propA" /* STRING */,
immediate: true /* BOOLEAN */,
endDate: Date.now(),
startDate: new Date(new Date().setFullYear(new Date().getFullYear() - 1))
};
me.PurgePropertyHistory(params);
var params = {
propertyName: "propB" /* STRING */,
immediate: true /* BOOLEAN */,
endDate: Date.now(),
startDate: new Date(new Date().setFullYear(new Date().getFullYear() - 1))
};
me.PurgePropertyHistory(params);
I see this question wasn't answered... Today I've needed the service and autodiscovered the correct way on specifying the property names.
You should pass a DataShape on which Property Name field it's propertyName not name. Something like:
var propertiesToPurge = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape( {
infoTableName : "InfoTable",
dataShapeName : "CustomDataShapeWithAFieldAsPropertyName"
});
propertiesToPurge.AddRow({ propertyName: "propA" });
propertiesToPurge.AddRow({ propertyName: "propB" });
me.PurgeSelectedPropertyHistory({
propertiesToPurge: propertiesToPurge,
startDate: 0,
endDate: dateAddYears((new Date()),1000)
});