Topic
6 replies Latest Post - ‏2013-03-06T22:03:54Z by SystemAdmin
SystemAdmin
SystemAdmin
174 Posts
ACCEPTED ANSWER

Pinned topic ccm syntax help needed!

‏2013-03-06T15:18:49Z |
Since the query function does not support direct comparison of attributes; I'm assuming I need to do this by nested queries. I would like to show records where submitter == resolver any help would be appreciated. Thank you.


ccm start -d \\ABC\ccmdb\dev -nogui -s http:
//ABC: 8400 -r ccm_admin ccm query 
"cvtype='problem' and crstatus='resolved' and safety_class='1E'" 
//Now I want to show only records from the previous query where          submitter == resolver. ccm stop


-Jim
Updated on 2013-03-06T22:03:54Z at 2013-03-06T22:03:54Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    174 Posts
    ACCEPTED ANSWER

    Re: ccm syntax help needed!

    ‏2013-03-06T15:52:58Z  in response to SystemAdmin
    I fear that you will have to do this in multiple steps, e.g.

    
    ccm query -u -f %problem_number,%submitter,%resolver 
    "cvtype='problem' and crstatus='resolved' and safety_class='1E'" | awk -F, 
    '$3==$2'
    

    Hope this helps,
    Mike


    Mike Scharnow, IT-QBase GmbH, Consultant for Software LifeCycle Management
    • SystemAdmin
      SystemAdmin
      174 Posts
      ACCEPTED ANSWER

      Re: ccm syntax help needed!

      ‏2013-03-06T16:08:45Z  in response to SystemAdmin
      Hello,

      Thank you for the feedback. but I'm getting a syntax error with "| awk -f, '$3==$2'"

      D:\Program Files (x86)\IBM\Rational\Synergy\7.2>ccm query -u -f %problem_number,%submitter,%resolver "cvtype='problem' and crstatus=
      'resolved' and safety_class='1E'" | '$3==$2'
      ''$3' is not recognized as an internal or external command,
      operable program or batch file.

      Any help would be appreciated since I'm fairly new to the ccm syntax.

      -Jim
      • SystemAdmin
        SystemAdmin
        174 Posts
        ACCEPTED ANSWER

        Re: ccm syntax help needed!

        ‏2013-03-06T16:38:44Z  in response to SystemAdmin
        Sorry, I did not recognize that you work in a Windows environment.

        The general idea is to have a query which gives you all problems and in a second step analyze the output and filter out everything where your condition is false.

        So, the ccm query gives you an output like
        problem#1,user1,user1
        problem#25,user15,user3
        problem#273,user3,user3

        You take this output and pipe it to another command, for which I chose awk.

        The result would be
        problem#1,user1,user1
        problem#273,user3,user3
        "awk" is a program which resides on all Unix machines and which (among other things) can filter text. It is available for Windows as well (e.g. at http://gnuwin32.sourceforge.net/packages/gawk.htm). So, you could download and install the program (the syntax for Windows is almost the same as for Unix, but you will need " instead of '

        
        ccm query -u -f %problem_number,%submitter,%resolver 
        "cvtype='problem' and crstatus='resolved' and safety_class='1E'" | (path/to/where/you/installed/awk)\bin\awk -F 
        "$3==$2"
        

        And you might want to put (path/to/where/you/installed/awk)\bin\ into your PATH variable, then you can write "awk" directly.

        An alternative to awk would be to use Windows Power Shell or some clever batch program.
        • SystemAdmin
          SystemAdmin
          174 Posts
          ACCEPTED ANSWER

          Re: ccm syntax help needed!

          ‏2013-03-06T18:40:42Z  in response to SystemAdmin
          Thank you for the help.

          My issue now is that not all valid records are showing due two having commas within the other attribute(s)(problem_synopsis) do now of a better approach?

          ccm query -u -f %problem_number,%crstatus,%safety_class,%problem_synopsis,%submitter,%resolver "cvtype='problem' and crstatus='resolved' and safety_class='1E'" | awk -F, "$6==$5" > e:\results.csv

          -Jim
          • SystemAdmin
            SystemAdmin
            174 Posts
            ACCEPTED ANSWER

            Re: ccm syntax help needed!

            ‏2013-03-06T19:55:18Z  in response to SystemAdmin
            just change the order of attributes...

            put submitter and resolver before the synopsis, then the problem cannot occur any more.
            Or use any other character for separation which does not appear so often, like §

            
            ccm query -u -f %problem_number§%crstatus§%safety_class§%problem_synopsis§%submitter§%resolver 
            "cvtype='problem' and crstatus='resolved' and safety_class='1E'" | awk -F§ 
            "$6==$5" > e:\results.csv