Topic
8 replies Latest Post - ‏2013-04-02T06:21:54Z by Dave-Robinson
SystemAdmin
SystemAdmin
47293 Posts
ACCEPTED ANSWER

Pinned topic An Element calculated by it's ID

‏2013-03-06T15:41:54Z |
Hello

Let me start from a simple code snippet:

Dim objCC As New ClearCase.Application
    Dim sFilePathName As String
    Dim objElement As ClearCase.CCElement
    
    sFilePathName = "X:\myView\myVob\myPath\fileName.txt"
    Set objElement = objCC.Element(sFilePathName)
    
    Debug.Print objElement.OID


This small program calculates an element ID - somthing like this: 2c651909.df82417f.9cd7.dc:68:75:4f:67:99

Now I'm looking for the inverse routine. The ID is my Input and I want to calculate the Element-Object.

Thanks for any help
Best regards
Wolfgang
Updated on 2014-03-26T13:41:29Z at 2014-03-26T13:41:29Z by iron-man
  • jeff98air
    jeff98air
    813 Posts
    ACCEPTED ANSWER

    Re: An Element calculated by it's ID

    ‏2013-03-06T16:31:10Z  in response to SystemAdmin
    I don't know whether or not you can get it from CAL, but you can from the CLI:
    cleartool desc -fmt "%En" oid:<oid>
    


    -Jeff Ng
    Updated on 2014-03-26T13:42:54Z at 2014-03-26T13:42:54Z by iron-man
    • jeff98air
      jeff98air
      813 Posts
      ACCEPTED ANSWER

      Re: An Element calculated by it's ID

      ‏2013-03-06T16:45:16Z  in response to jeff98air
      Yep, looks like you can do it in CAL by creating a new ClearCase.Cleartool object and run the "describe" subcommand I mentioned earlier in the CmdExec method.

      -Jeff Ng
    • SystemAdmin
      SystemAdmin
      47293 Posts
      ACCEPTED ANSWER

      Re: An Element calculated by it's ID

      ‏2013-03-06T16:56:35Z  in response to jeff98air
      Thanks, but this examples you can find anywhere, that is not the problem. The problem is that I'm looking for a (faster) solution which will be deliverd by the CAL.
    • SystemAdmin
      SystemAdmin
      47293 Posts
      ACCEPTED ANSWER

      Re: An Element calculated by it's ID

      ‏2013-03-06T16:56:51Z  in response to jeff98air
      Thanks, but this examples you can find anywhere, that is not the problem. The problem is that I'm looking for a (faster) solution which will be deliverd by the CAL.
      • brcowan
        brcowan
        701 Posts
        ACCEPTED ANSWER

        Re: An Element calculated by it's ID

        ‏2013-03-06T20:23:55Z  in response to SystemAdmin
        CAL doesn't natively provide the ability to go from OID to version/element. However, you can use the Cleartool.CmdExec method to call cleartool commands from within CAL applications. If you're using VB or something similar that should work fine. If you're using Perl, it makes more sense to go with calling cleartool directly as you get a bit more control and a lot more platform independence.

        =================================================================
        Brian Cowan
        Advisory Software Engineer
        ClearCase Software Advisory Team (SWAT)
        Rational Software
        IBM Software Group
        550 King St
        Littleton, MA 01460

        Phone: 1.978.899.5436
        Web: http://www.ibm.com/software/rational/support/
        • SystemAdmin
          SystemAdmin
          47293 Posts
          ACCEPTED ANSWER

          Re: An Element calculated by it's ID

          ‏2013-03-07T07:14:30Z  in response to brcowan
          Hello Brian

          > If you're using Perl

          Sorry but this is an absolutely new language for me.

          And the cleartool I've used for mouting a vob. But if I put your cleartool comand in this function I've

          Dim sElement As String
              Dim sDesc As String
              sDesc = "desc -fmt ""2c651909.df82417f.9cd7.dc:68:75:4f:67:99"" oid:<oid>"
              sElement = objCT.CmdExec(sDesc)
              Debug.Print sElement
          


          Sorry but the result is an error message "Unable to determine VOB for pathname "."." And "describe -help" does not tell me anything about "oid"

          And furthermore: I think that the id for an element is independend from the view which is used. So I have to add a view isn't it?

          Best regards
          Wolfgang
          Updated on 2014-03-26T13:42:48Z at 2014-03-26T13:42:48Z by iron-man
          • SystemAdmin
            SystemAdmin
            47293 Posts
            ACCEPTED ANSWER

            Re: An Element calculated by it's ID

            ‏2013-03-07T08:03:18Z  in response to SystemAdmin
            Soory it seems that %En% is not the variable ...

            Dim sElement As String
                Dim sDesc As String
                sDesc = "desc -fmt ""%%En"" oid:2c651909.df82417f.9cd7.dc:68:75:4f:67:99@myView\myVob"
                sElement = objCT.CmdExec(sDesc)
            


            And of course myView and myVob exists.

            Then the error message is:

            Unable to determine VOB for pathname "myView\myVob".

            Best regards
            Wolfgang
            Updated on 2014-03-26T13:42:39Z at 2014-03-26T13:42:39Z by iron-man
            • Dave-Robinson
              Dave-Robinson
              109 Posts
              ACCEPTED ANSWER

              Re: An Element calculated by it's ID

              ‏2013-04-02T06:21:54Z  in response to SystemAdmin
              Hello Wolfgang

              sDesc = "desc -fmt ""%%En"" oid:2c651909.df82417f.9cd7.dc:68:75:4f:67:99@\myVob"

              no reference to "myview"
              If the program is running in the context of myview\myVob, (that is, the process's working directory)
              then the VOB qualifier (@\myVob) is unnecessary

              David