Scott Piehn wrote:
> I am collecting an OID that is a counter for the total bytes transferred 
> in/out of a device.  Is there a way to auto format the number into KB, MB, GB 
> based on how large the number is
> 


You can use a CALCULATION variable with a chain of conditional expressions  
(condition ? if-true : if-false):

    $val >= 1024*1024*1024 ? sprintf("%.2f GB", $val / 1024*1024*1024) :
      $val >= 1024*1024 ? sprintf("%.2f MB", $val / 1024*1024) :
        $val >= 1024 ? sprintf("%.2f KB", $val / 1024) : 
            sprintf("%d B", $val)

You will need to expand this onto one line.


-------------------- m2f --------------------

Read this topic online here:
http://forums.dartware.com/viewtopic.php?p=1978#1978





____________________________________________________________________
List archives: 
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [email protected]

Reply via email to