Displaying decimal values when numbers are zeros

Hello,

How should a number be configured to display two decimal places when the decimal is all zeros? For example, when the number is 59.99 it shows up as ‘59.99’, but when the number is 60.00, only ‘60’ shows up, but I would like ‘60.00’ to be displayed.

@acj

This is not due to the viewON software but the tag value itself in the eWON.
The eWON will remove the decimal for a float if the value(s) after the decimal are 0.

I do not believe there is a way around this unfortunately but I will escalate to our development team to see if they have any feedback.

@acj

After speaking with a colleague, there’s a work-around that can be performed using java script in viewON so that you can view a static amount of decimal places within a text element.

  1. Select your text element

  2. Under graph properties / ID, find the UID and copy it.



  3. Click off of your symbol and then go to the actions tab for that view.

  4. Under the actions tab, right click and navigate to the java script section.

  5. In the java script section, paste the following:
    var test = getEwonTagVal(‘my_tag’).toFixed(2);
    $(’#UID_1530599448761’).text(test);

Note: you will need to replace the UID number and the tag name (my_tag) with your own values.

Hi Joe,

Thanks for your help. I tried the JavaScript and it worked, but when the value was ‘.0’ it briefly displayed just the number, then added the ‘.0’ on the next screen refresh.

I then tried changing the tag ‘Pattern’ from ‘#.#’ to ‘0.0’ and this actually works great:

So I will leave it like this and not use the Java code. If you see any issues with that, let me know.

Thanks!