1st is the name of the sold product
2nd is the negative or possitive sales by hour percentage value
i just want to get the minus number like -1,23 and show red down arrow near it
if its 0 show right arrow and then if it gets 1,23 value show the green up arrow like how we have on currency module.
Do i need to create table and insert the value snippet to the cell and then get it by javascript or is there a way to use snippet value directly inside the javascript code.
<script type="text/javascript">
function myFunction() {
var datavalue= 1;
var element = document.getElementById("arrow");
if (datavalue > 0) {
element.className = element.className.replace(/\bright-arrow\b/g, "up-arrow");
}
else if (datavalue < 0) {
element.className = element.className.replace(/\bright-arrow\b/g, "down-arrow");
}
else {
element.className = element.className.replace(/\bright-arrow\b/g, "right-arrow");
}
return;
}
</script>
For test use, i equaled datavalue to number, I’ve get black on preview screen and no data is displayed.
Actually in any type of working javascript makes preview screen black and nothing works. Also how can i work with dataset ticker snippets values and equal datasetvalue to snippet [value] ?
SOLUTION / SAMPLE; (I use each dataset row seperately inside different regions by filters becuase of my poroject design! If you need to repeat the same code for all the data inside one region, someone need to help for looping, cause i do not know to loop it for all rows)