PurgeSelectedPropertyHistory
描述
更新已記錄的內容時,其資料會寫入至與物件相關聯的值串流。您可以使用 PurgeSelectedPropertyHistory 服務來清除指定時間範圍內物件已記錄內容指定清單的歷史資料。
將清除呼叫服務之物件的內容記錄。如果您要清除多個物件的歷史資料,則必須針對每個物件呼叫服務。
此清除會同步執行。
輸入
參數名稱
描述
基礎類型
startDate
應清除歷史的開始日期,包括指定日期。
DATETIME
endDate
應清除歷史資料的過去日期,包括指定日期。
DATETIME
propertiesToPurge
應清除其資料之內容的名稱。內容的名稱會傳入資料負載中。資料負載的預期資料形式為 PropertyList
INFOTABLE
輸出
無。
範例
在下列範例中,TestThing 有三個已記錄內容:propertyA-LoggedpropertyB-Logged 與 propertyC-Logged。這些內容已多次更新,且已收集歷史資料。下列程式碼片段可用來清除物件已記錄內容之指定子集的記錄:
// Creating an infotable using the required datashape for specifying the names of properties to purge
var propertiesToPurge = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape( {
infoTableName : "InfoTable",
dataShapeName : "PropertyList"
});

// Adding the names of properties to the infotable created above
propertiesToPurge.AddRow({ propertyName: "propertyA-Logged" });
propertiesToPurge.AddRow({ propertyName: "propertyB-Logged" });
// Purging history
Things["TestThing"].PurgeSelectedPropertyHistory({
propertiesToPurge: propertiesToPurge, /* INFOTABLE */
startDate: 0, /* DATETIME */
endDate: dateAddYears((new Date()),1000) /* DATETIME */
});
這是否有幫助?