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

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
    817 Posts

    Re: An Element calculated by it's ID

    ‏2013-03-06T16:31:10Z  
    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
    817 Posts

    Re: An Element calculated by it's ID

    ‏2013-03-06T16:45:16Z  
    • jeff98air
    • ‏2013-03-06T16:31:10Z
    I don't know whether or not you can get it from CAL, but you can from the CLI:
    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">cleartool desc -fmt "%En" oid:<oid> </pre>

    -Jeff Ng
    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

    Re: An Element calculated by it's ID

    ‏2013-03-06T16:56:35Z  
    • jeff98air
    • ‏2013-03-06T16:31:10Z
    I don't know whether or not you can get it from CAL, but you can from the CLI:
    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">cleartool desc -fmt "%En" oid:<oid> </pre>

    -Jeff Ng
    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

    Re: An Element calculated by it's ID

    ‏2013-03-06T16:56:51Z  
    • jeff98air
    • ‏2013-03-06T16:31:10Z
    I don't know whether or not you can get it from CAL, but you can from the CLI:
    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">cleartool desc -fmt "%En" oid:<oid> </pre>

    -Jeff Ng
    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
    748 Posts

    Re: An Element calculated by it's ID

    ‏2013-03-06T20:23:55Z  
    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.
    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

    Re: An Element calculated by it's ID

    ‏2013-03-07T07:14:30Z  
    • brcowan
    • ‏2013-03-06T20:23:55Z
    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/
    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

    Re: An Element calculated by it's ID

    ‏2013-03-07T08:03:18Z  
    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

    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">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 </pre>

    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
    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
    116 Posts

    Re: An Element calculated by it's ID

    ‏2013-04-02T06:21:54Z  
    Soory it seems that %En% is not the variable ...

    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">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) </pre>

    And of course myView and myVob exists.

    Then the error message is:

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

    Best regards
    Wolfgang
    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