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:

SELECT COUNT(*) FROM "_SMDBA_"."_CONFIGDET_" WHERE "_CONFIG_" = {TR,Sequence}

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.

2 thoughts on “Orphaned Configurations and CSBRs

  1. Hi Alan,
    Have you tried using Math statements for an if..else statement? I just want to have one BR instead of creating two. this is for approving change request.
    below’s a sample:
    if request date < 04/28/2008) and start date = today(04/21/2008) and Desicion = ‘Pending’ from JeffF then
    Approver = WaltS
    elseif request date =< 04/28/2008 then
    Approver = JeffF

    I would realy apprecite your help and anyone’s help here thanks! a lot

  2. Hi there,

    Assuming the situation is something like when a Change Request is created, create a Change Approval with an approver of either this person or this person depending, what you can do is leave the conditions tab alone and on the actions tab where you specify the details of the Change Approval use a MATH statement in the Approver Login ID field:

    {MATH,(SELECT CASE WHEN “REQUEST_DATE” < ‘2008/04/28’ AND DATEDIFF(dd, “START_DATE”, GETDATE()) < 1 THEN ‘WaltS’ ELSE ‘JeffF’ END)}

    The system will then evaluate the condition as it creates the change approval. BTW I may have the field names wrong as I doing this from memory – will revise later .

    Let me know if this helps.

    Regards,

    Alan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s