This topic is locked
[SOLVED]

 Converting report field data

12/12/2013 3:05:07 PM
PHPRunner General questions
Z
zanimul author

I've created a database and associated reports using data from our backup system. Unfortunately, the raw data is in bytes and I'd like to convert the data to a human readable version in GB's at the report level. Still a newb here and have not been able to find any other forum conversations on the topic. I would think it can be done in the report itself, but it's not clear to me.
Any suggestions?
PHPRunner Enterprise 7.0 (build 18225)

Admin 12/12/2013

Could you post an example of raw data and a desired output? Also, what database do you use?

Z
zanimul author 12/13/2013



Could you post an example of raw data and a desired output? Also, what database do you use?


This is a MySQL DB, a single record of the raw data looks likes this before I add it to the database:

6,0,ADSM,05/03/2013,22:03:20,CB-CVEVA-1...,,WinNT,1,Tcp/Ip,1,0,0,0,0,472,3229143,0,0,3230607,2360,1743,128,0,4,0,0,0,0,3,2
The bolded numerical data represents the amount of data moved, in bytes, we'd much prefer to see the data listed in Gigabytes.
So, with the figure 3229143, I believe the correct calculation gives me (two decimal point rounded) a figure of 3.08 GB [1 byte =

9.31322575 × 10-10 gigabytes. This conversion also needs to persist through on the sum's, averages etc. of the reports.

Admin 12/13/2013

You can modify your SQL query calculating number of gigabytes on the fly.

select field1,

field2,

field3/1073741824 as newfield3

from ...


You can truncate the number of digits after comma and and 'Gb' either in SQL query itself or in Visual Editor.
PS. According to what I see these should be megabytes as opposed to gigabytes. If you need to handle both megabytes and gigabytes SQL query modification won't help. The best option then is to use 'View as' type Custom. Here is the sample script:

http://stackoverflow.com/questions/15188033/human-readable-file-size

Z
zanimul author 12/13/2013



You can modify your SQL query calculating number of gigabytes on the fly.

select field1,

field2,

field3/1073741824 as newfield3

from ...


You can truncate the number of digits after comma and and 'Gb' either in SQL query itself or in Visual Editor.
PS. According to what I see these should be megabytes as opposed to gigabytes. If you need to handle both megabytes and gigabytes SQL query modification won't help. The best option then is to use 'View as' type Custom. Here is the sample script:

http://stackoverflow.com/questions/15188033/human-readable-file-size


Ahhhh, thanks Sergey, your the best! My error on the data too, the one I was looking at was KB not bytes.
So here's my rendition in the SQL query:
SELECT

node,

bup_kb_retrv/1024/1024 as bup_gb_retrv,

acc_date

FROM dsmaccnt_load

WHERE (bup_kb_retrv > 10)

ORDER BY node, acc_date