Orphaned Configurations and CSBRs

In some organisations, orphaned configurations are an issue as it is through the assignment of the configuration to the end-user that assets are managed. This post seeks to a) demonstrate the use of MATH statements as a way of checking for the existance of child records for a given parent record, and b) using this technique, warn a support staff member that the current configuration is orphaned, such that it can be reassigned.

Let’s create the basic CSBR:

On Save of Configuration, Display Message:

"The current configuration is NOT assigned to a client. Please right-click on the Configuration Clients tab at the bottom of this screen, select Assign Client To Configuration, and then select the appropriate client from the list."

Make sure that you DON’T check the box titled “Exit Rule if ‘Ok’ clicked” as, if ticked, it would prevent you saving the configuration at all! This makes creating them a little bit of an issue!

Assign the CSBR to the Configuration form and save it. If we now open the Configuration form find a record and click save the popup message will appear, irrespective of whether the configuration is orphaned or not. So how do we check for an orphaned configuration?

The secret lies in a SQL statement:


The _CONFIGDET_ table holds the records for the linking of clients to configurations and these are deleted when clients are unassigned from configurations. Hence, by simply checking if the number of records in that table for the selected Configuration = 0 then we can establish if the configuration is orphaned or not.

So the final piece of the puzzle is adding this condition into our CSBR such that it only fires when a configuration is orphaned. Open the CSBR and add a condition as follows:

Expression 1: {MATH,(SELECT COUNT(*) FROM "_SMDBA_"."_CONFIGDET_" WHERE "_CONFIG_" = {TR,Sequence}) MT}; Comparison Operator: Equals; Expression 2: 0 (as in the number zero)

Save the CSBR and the task is complete.