Creating a backlog dashboard for various uses (BAQ driven).
I’m wondering if there’s a way to add a numberbox to use as a pseudo KPI. Basically to quickly provide a sum total of the Open Qty of the particular backlog.
So, my BAQ results come in, the grid populates… I know there are grid filters/summations I can use on the grid itself. But can I use a function to also analyze the BAQ results/dataview (via Kinetic-Function widget) and to spit back a sum value in the actionResults?
I feel like this should work… but, as a code-deficient individual… I’m hoping someone out there may have done this before and could provide a starting point. I can tweak… but coding from scratch is not a part of my bailiwick.
Figured I’d enter this into Chat-Chim-pan-zee and see what comes out… but welcome any and all comers who may have any clue how to pull this off.
Yes, pretty simple actually. You’ll have to decide how to trigger it, but you just have a function with a DataSet as input, and an output parameter with your sum.
You’ll pass the whole dataview as the input from the UI.
If you can show me the dataview structure, I can pop out a simple function for you, and link a thread for passing a dataview.
The target column, in this instance is: Calculated_RemainingQty
I can handle the event side of things (famous last words)… just need a code function to do the simple math. I’m assuming this is covered C# 101… but, I never got past the entrance exam.
Usually what I do for those (in classic admittedly, but I believe would work here) is just calculate the field in a column, but don’t show that column in the grid, only show it on the “tracker” view. All of the values are identical, so it looks static, but it’s technically an additional value for each row. So in the BAQ, do a windowing function.
sum(table.field) over (partition by table.fieldCommonToAllRows)
That will get you that calculated field with the sum of everything in the column you are looking for. Then you can bind that field to your text box up top.
Now… I don’t know how to do that in Kinetic yet, but I think the same approach should work.
I like Brandon’s way as well, depending on what you need.
//You can pass "Int64", "Decimal" for FieldToSumType, otherwise it will default to "Int32"
//Chose the "OutSumXXXX" you need.
switch (FieldToSumType.ToLower())
{
case "int64":
OutSumInt64 = InDS.Tables[TableName].AsEnumerable().Sum(x => x.Field<Int64>(FieldToSum));
break;
case "decimal":
OutSumDecimal = InDS.Tables[TableName].AsEnumerable().Sum(x => x.Field<decimal>(FieldToSum));
break;
case "int32":
default: //Int32
OutSumInt32 = InDS.Tables[TableName].AsEnumerable().Sum(x => x.Field<int>(FieldToSum));
break;
}
Well… I WAS thinking about doing it that way but thought perhaps a function would give me some flexibility to play with… tweak so if they filter the grid, it changes the value, etc.
I guess it depends on whether any future applied filters (which I haven’t built yet) would be filtering on the populated Dataview… or if I had my events rerun the BAQ with said filters.
I’ll have to explore both paths and see which better, considering I’m kinda building this dashboard on the fly without a fully defined plan in my head.
You can do simple calculations +,-,*,/ via the calculation widget… but I wasn’t sure how to do a sum of an entire dataview column. Played with it a bit but couldn’t find the magic code and decided I’d just lob a softball at Kevin, instead.
You could do a horrible for-loop in the client with a dataview-condition that evaluates to true for every row … and add the value from each row to a TransView field in the iterative event
I don’t know what the performance would look like … and I feel like there must be a JavaScript command you could throw at this in a row-update, since the data is all there already (I don’t know enough JS for set / table calculations)