StdDev Aggregate
FR Gurus:
Now that I have the basic aggregate functions flushed out. I am ready to tackle StdDev (Standard Deviation).
Following the suggestion of a previous post, I have created a "MyFunctions" unit. My new function StdDev now appears in the function palette.
Question
How do I send the [X][/i] 's of which I wish to obtain the StdDev for?
What would be ideal is for the function use within a report to be simply:
[STDDEV(<dsPANEL_DATA."TS.VFD_CURR_SPEED">,MasterData1,1) #n%3.1f]
But at a minimum I must some how send a delimited list of values to the function.
Please Advise...
Regard,
Monte Carver
Now that I have the basic aggregate functions flushed out. I am ready to tackle StdDev (Standard Deviation).
Following the suggestion of a previous post, I have created a "MyFunctions" unit. My new function StdDev now appears in the function palette.
Question
How do I send the [X][/i] 's of which I wish to obtain the StdDev for?
What would be ideal is for the function use within a report to be simply:
[STDDEV(<dsPANEL_DATA."TS.VFD_CURR_SPEED">,MasterData1,1) #n%3.1f]
But at a minimum I must some how send a delimited list of values to the function.
Please Advise...
Regard,
Monte Carver
Comments
I used DBCross and two events - one is on before print (cell), second is to calculate height of TotalRow.
And yet some pure (!) FastReport script to manage Values and three arrays of int.
The whole code has less then 60 lines of script.
Thank you for the inspiration on how much usefull a DBCross can be :-)
Mick
I don't suppose you could be persuaded to share the report/code of which you speak. Because your PDF is EXACTLY what I am looking to do.
Regards,
Monte Carver
Have a look at the topic [topic="7711"]DBCross - additional calculations at Total row[/topic]
You will find there a very simple example, just how to add something more to TotalRow.
Then you must define 3 arrays of int/real to cumulate values and waiting for TotalRow OnBeforePrint even.
One of arrays should be two dimmensional (in my example MyItems[0..11, 0..30]) to practically gather all DBCross values.
You should fill this array within obp Cell event using ColumnIndex and RowIndex.
And having this array of all values you'll be able to make anything you want.
Be carefull to avoid null Values which may come with obp Cell event.
Mick
PS.
In my practice I haven't had an occasion to use StdDev, so Wikipedia gave me a simple explanation :-)
PPS.
As you see I may be ... persuaded ;-)
Have a look at Jan 3rd and Nov 2nd. There are null values, but I missed them in script :-(
The minimum value in my example is 0 (zero) on 3rd day, and should be 1.
In my script I used
but I was not enough carefull ;-)
Mick