Expand all | Collapse all

sequence empty for baseline items that are not current

  • 1.  sequence empty for baseline items that are not current

    Posted 06-30-2020 15:09

    When I try to run a context sensitive velocity report from a baseline, I'm finding some curious behavior. If the item version in the baseline is the same as the current one, the "sequence" property returns the heading as expected (e.g. "2.4.3" ), but if the version in the baseline is an older version, the "sequence" property fails and you get something like $vdoc.sequence (if you don't suppress failures).

    I did a bit of testing on with the REST API, and it appears that the original sequence value is saved with the baseline (good!) and appears in the return body under "baselineLocation" -> "sequence" if you use the ".../baselines/{id}/versioneditems/{itemid}" endpoint (it does not appear in the ".../items/{id}/versions/{version}/versioneditem" endpoint). The REST API is not the preferred method for this particular report, but does confirm that the desired data exist.

    How can I get the versioned sequence information when exporting from a baseline context?


    Rafael Medina
    ON Semiconductor

  • 2.  RE: sequence empty for baseline items that are not current

    Posted 07-06-2020 09:45

    a good news / bad news update:

    The good news is that there is a way to pull the sequence information from the baseline items, using the following snippet (discovered by Roman): $documentSource.getDocumentNode(5, $documentSource.getVersionByDocumentId($

    The bad news is that this sequence appears to not actually be saved at the time of the baseline, but rather is a live value based on where the item is now. I'm not sure if that means this isn't the right way to get that information, or if it means that the document hierarchy is not actually saved when you do a baseline, which would be really bad.

    Rafael Medina
    ON Semiconductor

  • 3.  RE: sequence empty for baseline items that are not current

    Posted 07-06-2020 10:01
    a quick update, going through the REST api again I think the correct sequence is recorded there under the "baselineLocation" (my previous check had been on an item that hadn't changed location), so I'm optimistic that the correct information exists, but am still unable to access it from a velocity report.

    Rafael Medina
    ON Semiconductor

  • 4.  RE: sequence empty for baseline items that are not current

    Posted 07-07-2020 11:49

    Thank you for all this information. I don't have an answer about this just yet but, wanted to reach out and let you know that we are taking a closer look at this behavior. Feel free to add any other observations you may have to this thread and I will make sure it gets uploaded to the right place.

    Talk to you soon,

    Chloe Elliott
    Jama Software
    Portland OR

  • 5.  RE: sequence empty for baseline items that are not current

    Posted 07-07-2020 14:08
    Hi Chloe,

    Thanks, hopefully this area can be improved in the future.

    It turns out using "$documentSource.getDocumentNodeForBaseLine​(5, $, {baseline id} ).sequence" gets the same info as I was getting from the REST api (I thought I had tried that before, but maybe I missed something...). Unfortunately I don't have the baseline id when running from a context sensitive report, or a convenient way of determining that my context is a baseline and to use that function vs. just the regular $vdoc.sequence, which would force me to fork the report and maintain two copies of essentially the same report. (I could add a baseline parameter to the report, but that would could be confusing, particularly if a different baseline than the context was mistakenly selected by the end user)

    It seems to me that the baseline context should take precedence and all of the document / node information should act as if it were pulled from the baseline api calls, which would eliminate the need to distinguish​​ between a baseline and the live database for a context sensitive report. Right now it is incomplete and inconsistent, since items where the baseline version is the same as the current version use current sequence information instead of the baseline sequence (prone to silent errors), and items that have updated versions have no information at all by default, even if they haven't been moved.

    On a side note, is there any way to execute velocity code in a console type environment for development? The current debug loop is very tedious because you have to edit reports and re run them for each change, and the poorly documented velocity API requires a ton of reverse engineering (and iteration because there is no way to inspect the returned data structures).

    Rafael Medina
    ON Semiconductor

  • 6.  RE: sequence empty for baseline items that are not current

    Posted 04-26-2021 12:49

    Hello Rafael.

    I propose the script below to identify the source baseline from $documentList.

    The guiding idea is to find the baseline(s) that contain all the items listed in $documentList.

    The method is not efficient: the script will parse all the elements in $documentList if they actually come from a baseline.

    And the method is not precise either:

    1. just after the baseline is created from a source of items, the script doesn't make any difference between the source and the baseline: it returns the baseline.
    2. the scripts returns all the baselines that contains the items; not only the baseline selected in the baseline tab. 

    Hoping it will help you as much as your analysis helped me (and it really did, thank you) ...


    #set( $baselineIds = [] )
    #foreach( $vDoc in $documentList )
    #set( $version = $documentSource.getVersionByDocumentId($ )
    #if( $foreach.isFirst() )
    #foreach( $baseline in $version.getBaseLines() )
    #if( $baselineIds.add( $ ) ) #end
    #set( $newBaselineIds = [] )
    #foreach( $baseline in $version.getBaseLines() )
    #if( $baselineIds.contains($ )
    #if( $newBaselineIds.add( $ ) ) #end
    #set( $baselineIds = $newBaselineIds )

    #if( $baselineIds.size() == 0 )
    ## this item is in no baseline where the previous items are
    ## => $documentList is not built from a baseline

    #if( $baselineIds.size() > 1 )

    <p>Still a doubt about which baseline it is:
    #foreach( $baselineId from $baselineIds )

    #elseif( $baselineIds.size() > 0 )
    <p>Baseline = '$baselineSource.getBaseLine($baselineIds[0]).getName()'</p>

    <p>Not a baseline</p>

    Frederic GARFAGNI
    +33 6 74 72 75 93