Support

Expand all | Collapse all

Velocity Report - How to get the item from a field?

  • 1.  Velocity Report - How to get the item from a field?

    Posted 06-04-2020 01:50

    Hello.

    With a Velocity v8.44 script, I handle an item (itemA) which includes a field whose type is 'Item of Type' and thus contains another item (itemB).

    $velocityReportUtil.getValueForField() returns a string that "summarizes" itemB contained in itemA's field. In such a case, I rather need to get itemB itself to get and display its own fields.

    How can I get itemB contained in the field of itemA?

    Regards



    ------------------------------
    Frederic GARFAGNI
    Fresenius-Kabi
    GRENOBLE
    +33 6 74 72 75 93
    ------------------------------


  • 2.  RE: Velocity Report - How to get the item from a field?

    Posted 7 days ago

    According to Jama support, such a feature doesn't exist in Jama.

    We finally got around this lack by:

    1/ building a dictionary of all itemBs available in the project:
    #set( $itemBs = {} )
    #set( $docInfos = $documentSource.getDocumentInfoList(<itemB type ID>, $project.id, 1000) )
    #foreach( $docInfo in $docInfos)
         #set( $item = $documentSource.getDocument($docInfo.getId()) )
         #set( $itemBs[$item.documentKey] = $item )
    #end

    2. Given itemA, extracting itemB key from the string returned by $velocityReportUtil.getValueForField()
    #set( $itemBSummary = $velocityReportUtil.getValueForField( $itemA, <itemB field name>, $dateFormat ) )
    #set( $itemBKey = $itemBSummary.substring(0, $itemBSummary.indexOf(" ")) )

    3. Get itemB in the dictionnary
    #set( $itemB = $itemBs[$itemBKey] )



    ------------------------------
    Frederic GARFAGNI
    Fresenius
    GRENOBLE
    +33 6 74 72 75 93
    ------------------------------