EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: CSS : Label display precision
From: Hugo Slepicka <[email protected]>
To: Amien Crombie <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Thu, 19 Feb 2015 10:06:26 -0200
Hi Amien,

You can try this:

lb.setPropertyValue("text", value.toFixed(2));

HTH,
Hugo

On Thu, Feb 19, 2015 at 9:49 AM, Amien Crombie <[email protected]> wrote:
Hi
Here is the code I'm struggling with:

// _javascript_ file
importPackage(Packages.org.csstudio.opibuilder.scriptUtil);
importPackage(Packages.java.lang);
importPackage(Packages.java.util);

var lb = display.getWidget("Label_5");
var cset  = PVUtil.getDoubleArray(pvs[1]); // Get its double Array values from the 2nd PV waveform

var value = cset[0].getValue();   // just extract first element of array

lb.setPropertyValue("text", value);
//

My Label_5 displays a huge demical (like '1.7293458101234' etc).
I just need to have a precision of 2 '1.73' etc...
Any way to do this..

Thanks
Amien




References:
CSS : Label display precision Amien Crombie

Navigate by Date:
Prev: CSS : Label display precision Amien Crombie
Next: Looking for Allen Bradley PLC5 Ethernet support Mike Westfall
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: CSS : Label display precision Amien Crombie
Next: Looking for Allen Bradley PLC5 Ethernet support Mike Westfall
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·