Do you remember “Generic Charts”? No? Don’t worry – I didn’t either.
For years, we didn’t really pay attention to this feature, but “back in the days”, it was actually quite a nifty thing, where you could easily create a chart based on data of business central, save it in the table as a “Generic Chart”, which you could then use to add to a RoleCenter. Here are some screenshots (source: Building Charts in Microsoft Dynamics NAV 2015 – Evolution Business Systems (ebs.com.au)):
By adding your chart to the “Generic Charts” (as data), you could even add a chart on the RoleCenter (in C/AL) by adding a page part (subtype “chart”) to the RoleCenter page, and refer in properties to the right code.
So in a nutshell: “charting made easy”
Today, these “Generic Charts” are somewhat a mystery. Let me state some facts that I could discover:
The objects even are maintained with now also a namespace:
I just invented this in favour of the screenshot above. But – the message here is – since you could only refer to data in a table, the compiler couldn’t know whether it exists or not – so it just compiles and hopes for the best at runtime.
For years, Microsoft did foresee a bunch of charts in the “Generic Charts” in their default database:
But at some point, this stopped:
I wasn’t able to figure out which point exactly, but I checked in BC15, and the “Generic Charts” was empty, and it seems that up until v23, it was still empty. So – since “AL” it’s empty? I don’t know..
For me – this is an indication that Microsoft did a breaking change without me realizing it (other then: actively watching if the chart was displayed / had data).
Up until v23, we could have these chartparts in the product, referencing to non-existing charts. Nothing would show, but nothing would fail either (no errors).
From v24, that’s a different story…
We can’t add anything, so there’s also nothing to edit or remove .
I tried to import a chart from the early days – as a delegated admin, and as a global admin. No luck. So .. this begs the question – I don’t think Microsoft wants us to use it, right?
Now – why do I bring this up? Well, recently, when upgrading to v24, we ran against an unexplainable phenomenon: we had a crashing RoleCenter. Nothing had changed for years on this RoleCenter, but all of a sudden it crashed when we upgraded our first customer to our product in the cloud.
Very unexpected, because we pipeline the crap out of our releases .. and no indication whatsoever.. . No failing codecop, no failing compile, no breaking change, no failing test, .. Nothing!
Also: no Telemetry! (whaaaat ??) The crash was not reported in Telemetry, so our hands were tied.
It was only when we set up a local docker container, where we were able to reproduce the issue in v24, that we got this error in the eventlog:
"Not supported metadata element: Microsoft.Dynamics.Nav.Types.InfopartChartDefinition"
That good old EventLog .
That led us obviously to the path of the charts, and the investigation we did, where we found the facts mentioned above, and also made us wonder:
Well, I can only think of one thing: when migrating the RoleCenter from C/AL, nobody EVER has seen the chart. Up until today, the compiler, the pipellines, everything .. accepts the code. So – no indication whatsoever to delete the redundant lines.
IT’s only since v24, that there is a runtime error when having a chartpart on the RoleCenter (I repeat: compiler is still ok for this to be used in code!). And for that, I “blame” this DotNetCore crap (like I have been blaming many other things to the DotNetCore move in the past couple of weeks … ). I’m not sure – just a hunch.
I know what you’re thinking: just remove the control, right? I mean, we clearly shouldn’t be using this (or at least that’s my own personal assumption), so why add it on a page? Well .. welcome to AppSource, I guess: you can’t just remove a control, that’s a breaking change! People might have created a page extension that depends on your control – chartpart or not.
So, we wanted to make it obsolete, and still be able to fix the issue (“just” making it obsolete, would still crash the RoleCenter). So, as an extra thing we did, we transformed the control to a normal part (this would prevent the crash), but kept the name of the control. So there is no breaking change, and the runtime error was avoided! On top of that, we made it obsolete. So kind of like this:
Next release, we should be able to remove the control altogether (or at least, that’s what I believe – never did that before ;-)). But at least, this new version will make the RoleCenter work again.
One last thing you might wonder: did I check documentation? Well – yes . I wasn’t blown away with what I could find ;-).
Microsoft Learn pretty much limits its documentation to :
So .. yeah .. there you have it. Don’t use chartparts, I guess? And MS – may be make it obsolete altogether in one of the next releases? In any case – I’m going to search our chartparts, and get them the heck out of our code
Original Post https://www.waldo.be/2024/04/30/generic-charts-forgotten-but-not-gone/