HistoryMd: Array;
The HistoryMd property determines attributes history for MDM dictionary element.
Use JSON or the setHistoryMd method to set the property value, and the getHistoryMd method to get the property value.
This property contains an array of objects shown as metadata containing MDM dictionary elements history.
To execute this example, the page must contain the DictionaryBox component named dictionaryBox (see Example of creating the DictionaryBox component ). Find value history for the first child element, get its old and new value:
// Get MDM dictionary var source = dictionaryBox.getSource()[0]; // Get service for working with dictionary var service = source.getPPService(); // Get dictionary children var childEls = source.getChildEls(); // Get history of attributes values for the first child element var history = childEls[0].getHistoryMd(); if (history) { for (var i = 0; i < history.length; i++) { console.log("Start date: %s, end date: %s", history[i].inDate, history[i].outDate); }; // Get data linked to the element var linkedData = childEls[0].getLinkedData(); console.log("Element name: %s, old value of the element: %s", linkedData[1]["@v"], linkedData[4]["@v"]); } else { console.log("History of attributes values for the first child element is not defined"); };
After executing the example the browser console shows attributes history for the first child element, as well as its old and new value.
Start date: 2013-10-31, end date: 2999-12-31
Element name: Decade, old value of the element: 0
An appropriate notice is shown in the browser console, if the history of attribute values for the first child element is not defined.
See also: