Hi,
my Java Adapter has a following piece of code:
final Map<String, String> sentimentIndexMap = new HashMap<String, String>();
sentimentIndexMap.put("INDEX", Double.toString(sentimentIndex));
listener.update("SENTIMENT", sentimentIndexMap, false);
Now, when I try to get the SENTIMENT INDEX property in javascript using any of the following lines I get nothing:
var si = updateInfo.getNewValue("INDEX");
var si = updateInfo.getNewValue("SENTIMENT.INDEX");
var si = updateInfo.getNewValue("SENTIMENT");
So, the question is: how do I extract that value? and why does the same works for other parameters ("BID"):
var pushtable = new OverwriteTable(null, null, "MERGE");
pushtable.onItemUpdate = updateItem;
pushtable.onChangingValues = formatValues;
pushtable.setPushedHtmlEnabled(true);
page.addTable(pushtable, "quotestable");
function updateItem(item, updateInfo) {
if (updateInfo == null) {
return;
}
if (updateInfo.getNewValue("BID") == null) {
return;
}
var oldLast = updateInfo.getOldValue("BID");
if (oldLast == null) {
updateInfo.addField("#trend_color",greenColor,true);
} else if (updateInfo.isValueChanged("BID")) {
if (oldLast > updateInfo.getNewValue("BID")) {
updateInfo.addField("#trend_color",redColor,true);
} else {
updateInfo.addField("#trend_color",greenColor,true);
}
}
if (item != null && item >= 0 && item <= quotesarr.length) {
var currentTime = new Date();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
if (minutes < 10){
minutes = "0" + minutes;
}
var timetextfield = document.getElementById(quotesarr[item-1]+'.TIME').innerHTML = hours + ":" + minutes;
}
var si = updateInfo.getNewValue("INDEX");
if (si != null) {
var blatextfield = document.getElementById('bla').innerHTML = si;
} else {
var blatextfield = document.getElementById('bla').innerHTML = "bla";
}
}
function formatValues(item, itemUpdate) {
if (itemUpdate == null) {
return;
}
itemUpdate.setHotTime(fadeout);
var backH = itemUpdate.getServerValue("#trend_color");
itemUpdate.setAttribute("BID",backH, null,"backgroundColor");
itemUpdate.setAttribute("ASK",backH, null,"backgroundColor");
}