Topic
2 replies Latest Post - ‏2014-01-08T06:34:03Z by devil786
devil786
devil786
126 Posts
ACCEPTED ANSWER

Pinned topic counting number of child nodes under each parent node

‏2014-01-06T07:56:08Z |

Hi,

is it possible to count the number of child service instances under each parent service instances?

 

 

  • randybrown
    randybrown
    59 Posts
    ACCEPTED ANSWER

    Re: counting number of child nodes under each parent node

    ‏2014-01-07T19:41:37Z  in response to devil786

    Hi,

    If you want this value to be an attribute of a service instance that you can display in a TBSM view or scorecard, then you can add a TBSM formula rule that returns "ServiceInstance.NumChildren" as the result of the policy. Such a formula rule would have to be added to one of the templates tagged to a service for which you need the information.

    If you are just trying to gather statistics about your total data model, then the rad_radshell utility could be used to look at the data model. I have attached a sample rad_radshell script that will print each service instance name, its display name, and a count of the child instances (only 1 level). You can modify this script if you just want to see a specific service, rather than looping through them all.

    I tested it fairly briefly, so no warranties are implied :-), but I think it should help out. Note that it may take a while to run, depending on how many service instances are in the model.

    You would run this script as follows (Windows example)

                type countChildInstances.radsh | %TBSM_HOME%\bin\rad_radshell.bat > countChildInstances.out

    and then you should have a file called countChildInstances.out with the output.

    Lastly, there is a "shipped" rad_radshell method called "countOfChildren("instancename");". This method returns a count of all dependents starting from the specified instance name. It does not stop at just one level, as is the case with the script I attached.

    Hopefully one of these solutions covers what you are needing.

    Regards...
     

    Randy Brown      

    Attachments

    • devil786
      devil786
      126 Posts
      ACCEPTED ANSWER

      Re: counting number of child nodes under each parent node

      ‏2014-01-08T06:34:03Z  in response to randybrown

      Hi Randy,

      Thanks for sharing the information, i tried rad_radshell method called "countOfChildren("instancename");". and the output is fine, once again thanks for the help.

       

      with regards,