I am using the Frequency Chart metric in ProfilerProbe to get the frequency of values in a table.
Curently there is a property that allows you to limit the maximum number of unique values, however if this threshold is exceeded during the computation, the histogram will not be shown at all.
Is there a way to configure the profiler probe so that rather than disabling the histogram when the limit is exceeded, it shows highest occurances within that threshhold?
e.g. if the Maximum unique values = 6, the frequency histogram will display the top 6 most frequent values.
Unfortunately, the component cannot be configured this way. It is actually quite old component and its bigger CloverDX Server counterpart - Profiler - has been discontinued completely, therefore, I’m afraid there will be no further development of this component taking place.
Nevertheless, the functionality you seek can be achieved using either quite complicated code (either CTL or Java) or by using couple of existing components. I have prepared an example for you (attached) that contains a testing graph and a subgraph that does the operation itself. The subgraph consists of 4 components and nicely wraps up the operation in case you need to use it multiple times. Let me try to explain the workflow here.
First, a Normalizer. This step takes the single incoming map record and creates as many records as there are elements in the map. These contain two separate fields for key and for value. This is necessary to be able to easily sort the map entries down the line.
ExtSort sorts these records based on the value (second field) in order to eventually get only the values that were present the most.
Dedup limits the number of the already sorted records so this is where we’re getting the actual number of records on the output.
Denormalizer takes the records and creates the same map that we had on the very input of the subgraph so that the output is consistent with the input.
The CTL code (if any) of the components used is very short and should be quite understandable but if you have any questions, please feel free to ask.
The testing graph is just generating a number of random records and sending it to a ProfilerProbe and then there’s the subgraph inserted.