Hello,
I am currently evaluating the Flexmonster Pivot grid for our reporting solution in Blazor and while it looks very powerful, I wasn't sure how to address a specific case that we have in our data. I think I may be missing something simple but if you can help me out here, I can take this to business and see if we can get a license for our SaaS application.
My sample data is as follows. We have some invoice numbers in the Cost and ChargeCost columns. When the BatchStatusName = Received, we should display sum(Cost) else sum(ChargeCost). Also, we want to group them in such a way that Received goes into one group and the rest in other. I have attached a sample layout of how the report should look like. I tried using calculated measure and hierarchies but was unable to get the desired layout. I could change my data so some of the groupings can be done on the database side but I would rather do it on the client side on the pivot grid so I can use the same data for another report which has a different layout.
I would really appreciate if you can provide me some guidance.
Thanks,
Rushi
[
{
"HealthSystemName": "H1",
"FacilityName": "F1",
"ProgramName": "Amgen Safety Net Foundation",
"ProductName": "Xgeva",
"InvoiceDate": "2013-01-01",
"Cost": 50716.30,
"ChargeCost": 45287.700000,
"BatchStatusName": "Received"
},
{
"HealthSystemName": "H1",
"FacilityName": "F2",
"ProgramName": "Eisai Patient Assistance Program",
"ProductName": "Aloxi",
"Cost": 0.00,
"ChargeCost": 43670.510000,
"BatchStatusName": "Received"
},
{
"HealthSystemName": "H1",
"FacilityName": "F1",
"ProgramName": "Astellas Stock Replacement Program",
"ProductName": "Lexiscan",
"InvoiceDate": "2015-11-01",
"Cost": 795.92,
"ChargeCost": 782.120000,
"BatchStatusName": "Received"
},
{
"HealthSystemName": "H1",
"FacilityName": "F1",
"ProgramName": "Astellas Stock Replacement Program",
"ProductName": "Lexiscan",
"Cost": 0.00,
"ChargeCost": 1471.750000,
"BatchStatusName": "Unverified"
},
{
"HealthSystemName": "H2",
"FacilityName": "F3",
"ProgramName": "Entyvio Connect",
"ProductName": "Entyvio",
"InvoiceDate": "2022-11-01",
"Cost": 7687.01,
"ChargeCost": 8148.210000,
"BatchStatusName": "Submitted"
},
{
"HealthSystemName": "H2",
"FacilityName": "F3",
"ProgramName": "Genentech Patient Foundation - Infused",
"ProductName": "Kadcyla",
"InvoiceDate": "2019-11-01",
"Cost": 18032.64,
"ChargeCost": 7458.680000,
"BatchStatusName": "Shipped"
}
]
Hello, Rushi!
Thank you for reaching out to us.
Kindly note that Flexmonster doesn't support comparing strings in calculated values out of the box. For such cases, we kindly suggest presenting your string data in numeric format, for example:
"Received" = 1
"Unverified" = 2
"Submitted" = 3
"Shipped" = 4
Then, you can use If
formula for determining the field to aggregate:
formula: 'if(min("BatchStatusNumber") = 1, sum("Cost"), sum("ChargeCost"))'
We have prepared a JSFiddle with data visualization from the provided screenshot: https://jsfiddle.net/flexmonster/v05h2t1s/.
In this sample, we have added the BatchStatusNumber
field to your data, which contains the numeric identifiers for each Status value. We have also added the BatchStatus
field to determine whether the process is In progress
or Invoiced
.
Hope you will find our answer helpful.
Please let us know if the suggested approach works for your case.
Kind regards,
Solomiia
Hi Solomiia,
Thank you for your quick response.
Your solution looks good for the JavaScript version but I am using the Pivot component in a Blazor WASM application and I don't see the customizeCell event exposed there. Am I missing anything?
Thanks,
Rushi
Hello, Rushi!
Thank you for your swift response.
Kindly note that it is possible to use customizeCell
while integrating with Blazor using the JavaScriptHandler
property.
You can use the customizeCell
in a new JavaScript function as follows:
window.YourJavaScriptHandler = (flexmonsterObject) => { flexmonsterObject.customizeCell = function(cell, data) {
//customize cell functionality here
}; }
And then define this function in Blazor:
<FlexmonsterComponent Report="@report" JavaScriptHandler="YourJavaScriptHandler" />
You are welcome to read the step-to-step guide which describes this approach: https://www.flexmonster.com/doc/access-features-via-js-blazor/.
Hope you will find our answer helpful. Please let us know if the suggested approach works well for your case.
Kind regards,
Solomiia
Hi Solomiia,
Appreciate your quick response.
I tried your suggested approach but it doesn't seem to work. I have another ticket that was similar about handling events in Blazor WASM. So, let me add my findings in there so others can benefit.
Thanks,
Rushi
This question is now closed