Value formatting

Started by Nikk, March 24, 2014, 05:35:59 PM

Previous topic - Next topic

Nikk

Hi,

How can i get clean formatted value in last value window (or better as event parameter)? What I want to do is format or round disk space value.
The value shows up like 12.410000 , but it should be like 12.41 (as it shows in history table)  because transformation script is: format($1,1,2) or round($1,2).

And event parameter %4 is also taking those zeros. How can I get rid of those zeros?

Nikk

Victor Kirhenshtein

Hi!

You can format event parameter using script, like this:

1. use %[formatted_p4] instead of %4

2. Create script named formatted_p4 in library like this:

return format($event->parameters[4], 1, 2);

Best regards,
Victor

Nikk

Thank you, Victor! Works great :)

Shebarn

#3
I have the same problem with voltage return as float.

My Transformation looks like this normally:

return $1/10;

(since the value returned is always 10x the actual voltage value)

But this always gives me a value of i.e. 23.500000

return format($1/10, 1, 1) gives the right value when I test it at transformation but not when the alarm is raised.

I tried Victor's solution of script:

Script Name: retvolt
Script Content: return format($event->parameters[1]/10, 1, 1);

At transformation I then put: return $[retvolt];

I get error: Error 34 in line 1: Function or operation argument is not a container

I assume I am calling the script the wrong way, but can't find examples of how to do it otherwise?
Please help.

Shebarn

Ok, figured it out.

Used the script in the message of the event's event configuration and it worked perfect...