I am trying to make a Class object that contains methods and properties I find usefull when working with distribution reports.
I have everything working how I would like it when I don't try and filter the report or data table but when I try and fitler the report I start having issues.
Main issue being is after I filter the report when I go into the display tree to pull and save values they don't reflect the filter. For example if the column I am analyzing has a mean of 132 before filtering and a mean of 134 after filtering the distirbution report will show 134 for the mean but the display tree will output 132.
Make Distribution = Method({filter={}},
Try(
Column(dt,col) << Set Name("Data");
show(NItems(filter)!=0);
If(
NItems(filter)!=0,
dist = dt << Distribution(
Automatic Recalc( 1 ),
Continuous Distribution( Column( :Data ),
Local Data Filter(
Add Filter(Where(:Data >= filter[0] & :Data<= filter[1]))
)
),
),
dist = dt << Distribution(Automatic Recalc(1),Continuous Distribution(Column(:Data)));
);
rdist = dist << Report;
show(rdist[1]);
tmp = rdist["Summary Statistics"][NumberColBox(1)] << Get As Matrix;
mean = tmp[1];
stdev = tmp[2];
std_err_mean = tmp[3];
up_95_mean = tmp[4];
low_95_mean = tmp[5];
N = tmp[6];
dist_graph = rdist[OutlineBox("Data")][PictureBox(1)];
Column(dt,"Data") << Set Name(col);
,
Throw("Error in Making Distribution: "||char(exception_msg))
);
);
Above is the method where I am making the distribution report, adding the local filter, and pulling summary statistic's values from the display tree.
I have also tried using a Select Where and Delete Rows routine but the Select Where isn't doing anything when inside the method that method is below.
Filter Table = Method({filter},
dt << Select Where(Column(dt,col)<filter[1] | Column(dt,col)>filter[2]);
dt << Delete Rows;
);
I am doing this as I fairly often need to get various summary statistics or elements out of distribution reports and this makes it an easy syntax and easy to change.
I have attached the full class to this post.
Any help would be appreciated.