It's all about the answers!

Ask a question

How to extract a count of the number of Components in the repository


nannette Mori (50464) | asked Sep 30 '16, 4:50 p.m.
We need to provide a count of the number of components in the repository.  Is there a way to extract this information from RTC

One answer



permanent link
Alan Sampson (93749) | answered Oct 02 '16, 12:40 a.m.
JAZZ DEVELOPER
edited Oct 02 '16, 9:50 p.m.
A quick and dirty way to do this would be with the SCM command line interface:

lscm login -r https://clmserver.your.com:9443/ccm -n JU -u jazz_user -c
Password (jazz_user @ https://clmserver.your.com:9443/ccm):
Logged in to https://clmserver.your.com:9443/ccm

lscm list components -r JU --all
(1015) "Scrum001 Default Component"
(1016) "Scrum002 Default Component"
...

Capture the output to a file and count the results or pipe it into a program like wc and have it count the lines for you (untested but I don't see why it wouldn't work):

lscm list components -r JU --all | wc -l


Or if you prefer you can write the output as JSON:

lscm list components -r JU --all --json
{
    "components": [
        {
            "name": "Scrum001 Default Component",
            "url": "https:\/\/clmserver.your.com:9443\/ccm\/",
            "uuid": "_4BSP0AXMEeaNrsV1PND6zw"
        },
    ...
}

From there it's just a "simple matter of programming" to parse the JSON and count the components.

See http://www.ibm.com/support/knowledgecenter/SSYMRC_6.0.2/com.ibm.team.scm.doc/topics/list_components.html for the CLI scm list components command syntax.

Your answer


Register or to post your answer.