Announcement

Collapse
No announcement yet.

BRX - Stored value truncated when using STRPRINT CMD.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts


  • BRX - Stored value truncated when using STRPRINT CMD.

    I am using the STRPRINT command to print a value that is in RO register and storing it at SS0. Value is truncated.

    Value in R0 = 10.123 After STRPRINT R0 "PSIG" to SS0 HMI Displays 10.12 PSIG
    Value in R0 = 10.001 After STRPRINT R0 "PSIG" to SS0 HMI Displays 10 PSIG
    Value in R0 = 10.011 After STRPRINT R0 "PSIG" to SS0 HMI Displays 10.01 PSIG

    How do I format the results of STRPRINT so I get three decimal places from my value in to SS0?

    Is this possible?

    Thanks
    Last edited by skyfox; 04-10-2019, 07:29 PM.


  • #2
    Look in help at String Scripting Language Reference and then scroll down to Format a Real (floating point) Value

    Comment



    • #3
      Originally posted by Mike Nash View Post
      Look in help at String Scripting Language Reference and then scroll down to Format a Real (floating point) Value
      Thanks Mike,

      That did the trick. Much appreciated.

      And for those other newbies finding their way around Do-More using the BRX, it is the "STRPRINT" function. And, the syntax is...

      FmtReal(R0,4,2,dec) "PSIG"

      In mycase, source was R0 (obviously). Destination can be a string data type of your own choosing. In my case, it was SS0. For me, "PSIG" was the desired EU, but it can be any string literal that you want, provided your destination is equipped to handle the number of characters required. Or, you can leave it out all together. Some pretty nice functionality built in to this baby.

      Soooo, how do I now mark this post as "SOLVED", "FIXED", "TAKEN CARE OF", "ANSWERED" etc., so someone else looking for the same thing, won't waste a lot of time in the vast internet?

      Thanks again.

      Cheers.

      Comment

      Working...
      X