The record count plugin calculates the number of records contributing to a result, including any records with null values.
It is designed to be used in conjunction with other Data Control modules. For example, it can be useful if you are writing your own Data Control API module and need to obtain the record count.
The following example shows how to configure the record count plugin.
method addmethod <method_id> mandatory <display_name>
method <method_id> common addproperty FREQ TRUE
method <method_id> common addproperty CELL_ERRORS TRUE
method <method_id> adddcplugin recordcount recordcount 1
The cube containing the values is called
RECORD_COUNT. You can then use this as input to another data control module, such as the perturbation module (as shown in the following example).
Conceal Related Summations when using Perturbation
If you are using perturbation, then you may want to use the record count plugin in conjunction with the perturbation and confidentiality plugins to conceal related summations.
One example of a scenario where this might be required is if perturbation is enabled and the user adds both a record count and a summation (such as the mean) to the table. The count might be perturbed to zero but the mean might be non-zero, which tells the user that the record count is really not zero.
The following example configuration hides summations when the record count has been perturbed to zero.
Login to SuperADMIN and create a new mandatory method:CODE
> method addmethod "PerturbationMethod" mandatory "Perturbation with Suppression of Associated Measures"
In this example, the method ID is "PerturbationMethod" and the display name is "Perturbation with Suppression of Associated Measures", but you can set these to whatever values you prefer on your system.
Set the following common properties for the method:CODE
> method "PerturbationMethod" common addproperty RKEY "true" > method "PerturbationMethod" common addproperty RKEYWANTNULLS "true" > method "PerturbationMethod" common addproperty FREQ "true" > method "PerturbationMethod" common addproperty CELL_ERRORS "true"
Add the perturbation and record count Data Control plugins to the method:CODE
> method "PerturbationMethod" adddcplugin recordcount recordcount 1 > method "PerturbationMethod" adddcplugin perturbation Perturbation 2
It is important to set the priorities of the two plugins so that the record count plugin is applied first.
Add a property to the perturbation plugin that instructs it to perturb the results of the record count:CODE
> method "PerturbationMethod" perturbation addproperty RULESET "PERT()|PERT(true,RECORD_COUNT)"
If there are other properties you want to set for perturbation, specify them now in the usual way:CODE
> method "PerturbationMethod" perturbation addproperty <property_name> <property_value>
Finally, add the confidentiality plugin to the method (with the priority set to 3, so it is applied after the other two plugins), and configure it to conceal cells based on the perturbed record count:CODE
method "PerturbationMethod" adddcplugin confrule confidentialityrule 3 method "PerturbationMethod" confrule addproperty RULESET "FREQ(0,RECORD_COUNT)"
You can now apply your completed method to your databases in place of your existing perturbation method.