Skip to content
  • There are no suggestions because the search field is empty.

How to use Format String in DataHub WebView

This example shows you how to get the tag name, value, and timestamp and use format string to limit the decimal places and format the timestamp in an easy to read format.

  1. Open the control's properties and find the property you are binding to.
  2. Set the binding to Script and use the script below.
    var pv = WV.GetPoint("DataPid:PID1.Pv");

    var msg = string.Format("{0} was updated to {1:0.000} at {2:hh:mm:ss tt}.",
       pv.PointName, pv.Value, pv.TimestampAsLocalTime);

    msg;

The tag in this example is "DataPid:PID1.PV".  This is where you would modify the script to add your tag name.

The format of 0.000 will display up to 3 decimal places.