Jama variables and tools available to Velocity Reports

Jeff Abbott
Jeff Abbott Member, Data Exchange Posts: 31

I'm trying to generate a report from a set of item types that includes a folder hierarchy. 

I have set my report to be context sensitive so that $documentList includes all item types. However I am unable to return any fields at all through either $doc.getCustomFields() or $velocityReportUtil.getValueForField().

I would greatly appreciate a generic example that simply iterates over the fields (picklists, string#, and integers) of an ContourItem and prints those out in an HTML velocity template.

Comments

  • Jeff Abbott
    Jeff Abbott Member, Data Exchange Posts: 31
    edited October 2022

    Quick Guide:
    https://community.jamasoftware.com/blogs/shawnna-williams/2021/06/25/navigating-the-velocity-api-documentation

    Velocity Report Util:
    http://velocity.jamasoftware.com/latest/OldVelocity/com/jamasoftware/contour/report/util/VelocityReportUtil.html

    Jama API
    http://velocity.jamasoftware.com/latest/OldVelocity/overview-summary.html

    ------------------------------
    Jeff Abbott
    Leidos
    Orlando FL
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 10-07-2022 07:15
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    Where can I find the list of available Jama variables and tool access methods for Velocity Reports?  For example $documentList.

    I'm trying to generate a report from a set of item types that includes a folder hierarchy. I'm also interested in any pointers to my current report issue of not having any items being returned from the $documentList.

    My html template includes the following script, but I am not able to return any field values. The example below is attempting to return "requirement_type" which is a pick list. 

    Script:

    #set($dateFormat=$dateTool.get('default','short'))
    #set($docDao = $applicationContext.getBean("documentDao"))
    Project: $project.name<br/>
    Description: $project.description<br/>
    Date Format: $dateFormat <br/>

    #foreach( $vDoc in $documentList )
    #set( $type = $velocityReportUtil.getValueForField($doc, "requirement_type", $dateFormat ))
    type : $type</br>
    $doc.document.name<br/>
    #end

    Output:

    Project: My Project Template
    Description:
    Date Format: Oct 7, 2022, 2:12 PM

    ------------------------------
    Jeff Abbott
    Leidos
    Orlando FL
    ------------------------------
  • Alessandro Valli
    Alessandro Valli Member, Data Exchange, Jama Connect Interchange™ (JCI) Posts: 785
    edited October 2022
    #foreach($docitem in $documentList)
    do something with $docitem.document
    or call a method from $documentSource by using the item id ($docitem.document.id)
    #end

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 10-07-2022 07:15
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    I'm trying to generate a report from a set of item types that includes a folder hierarchy. 

    I have set my report to be context sensitive so that $documentList includes all item types. However I am unable to return any fields at all through either $doc.getCustomFields() or $velocityReportUtil.getValueForField().

    I would greatly appreciate a generic example that simply iterates over the fields (picklists, string#, and integers) of an ContourItem and prints those out in an HTML velocity template.

    Alessandro
    Systems Engineer
    SICK AG
  • Jeff Abbott
    Jeff Abbott Member, Data Exchange Posts: 31
    edited October 2022

    Thanks for the pointer Alessandro,

    I found my first problem which as not setting $doc = $vDoc.document.  To my surprise, the custom fields were also retrievable using $velocityReportUtil.getValueForField($doc, "req_list_type", $dateFormat ))
    However, my new challenge is not being able to access the attachments (figures) on each item. Neither of these two methods work for me:

    #set( $attachmentList = $attachmentDAO.getDocument_DocAttachments($mathTool.toInteger($docI.Id) )
    #set($attachmentId= $doc.getAttachment())

    Jeff


    ------------------------------
    Jeff Abbott
    Leidos
    Orlando FL
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 10-08-2022 08:36
    From: Alessandro Valli
    Subject: Jama variables and tools available to Velocity Reports

    #foreach($docitem in $documentList)
    do something with $docitem.document
    or call a method from $documentSource by using the item id ($docitem.document.id)
    #end

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG
    ------------------------------

    Original Message:
    Sent: 10-07-2022 07:15
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    I'm trying to generate a report from a set of item types that includes a folder hierarchy. 

    I have set my report to be context sensitive so that $documentList includes all item types. However I am unable to return any fields at all through either $doc.getCustomFields() or $velocityReportUtil.getValueForField().

    I would greatly appreciate a generic example that simply iterates over the fields (picklists, string#, and integers) of an ContourItem and prints those out in an HTML velocity template.

  • Alessandro Valli
    Alessandro Valli Member, Data Exchange, Jama Connect Interchange™ (JCI) Posts: 785
    edited October 2022

    Hey Jeff, 
    are you using a Jama version < 8.42?

    DAOs are not available in newer versions.
    Here you can use $documentSource.getAttachment($mathTool.toInteger($nAttId))

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 10-10-2022 06:48
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    Thanks for the pointer Alessandro,

    I found my first problem which as not setting $doc = $vDoc.document.  To my surprise, the custom fields were also retrievable using $velocityReportUtil.getValueForField($doc, "req_list_type", $dateFormat ))
    However, my new challenge is not being able to access the attachments (figures) on each item. Neither of these two methods work for me:

    #set( $attachmentList = $attachmentDAO.getDocument_DocAttachments($mathTool.toInteger($docI.Id) )
    #set($attachmentId= $doc.getAttachment())

    Jeff

    ------------------------------
    Jeff Abbott
    Leidos
    Orlando FL
    ------------------------------

    Original Message:
    Sent: 10-08-2022 08:36
    From: Alessandro Valli
    Subject: Jama variables and tools available to Velocity Reports

    #foreach($docitem in $documentList)
    do something with $docitem.document
    or call a method from $documentSource by using the item id ($docitem.document.id)
    #end

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG

    Original Message:
    Sent: 10-07-2022 07:15
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    I'm trying to generate a report from a set of item types that includes a folder hierarchy. 

    I have set my report to be context sensitive so that $documentList includes all item types. However I am unable to return any fields at all through either $doc.getCustomFields() or $velocityReportUtil.getValueForField().

    I would greatly appreciate a generic example that simply iterates over the fields (picklists, string#, and integers) of an ContourItem and prints those out in an HTML velocity template.

    Alessandro
    Systems Engineer
    SICK AG
  • Jeff Abbott
    Jeff Abbott Member, Data Exchange Posts: 31
    edited October 2022
    Right, sorry for the confusion.  I am setting $attachmentDao as follows:
    #set( $attachmentDao = $documentSource )

    Jeff

    ------------------------------
    Jeff Abbott
    Leidos
    Orlando FL
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 10-10-2022 08:39
    From: Alessandro Valli
    Subject: Jama variables and tools available to Velocity Reports

    Hey Jeff, 
    are you using a Jama version < 8.42?

    DAOs are not available in newer versions.
    Here you can use $documentSource.getAttachment($mathTool.toInteger($nAttId))

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG
    ------------------------------

    Original Message:
    Sent: 10-10-2022 06:48
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    Thanks for the pointer Alessandro,

    I found my first problem which as not setting $doc = $vDoc.document.  To my surprise, the custom fields were also retrievable using $velocityReportUtil.getValueForField($doc, "req_list_type", $dateFormat ))
    However, my new challenge is not being able to access the attachments (figures) on each item. Neither of these two methods work for me:

    #set( $attachmentList = $attachmentDAO.getDocument_DocAttachments($mathTool.toInteger($docI.Id) )
    #set($attachmentId= $doc.getAttachment())

    Jeff

    ------------------------------
    Jeff Abbott
    Leidos
    Orlando FL

    Original Message:
    Sent: 10-08-2022 08:36
    From: Alessandro Valli
    Subject: Jama variables and tools available to Velocity Reports

    #foreach($docitem in $documentList)
    do something with $docitem.document
    or call a method from $documentSource by using the item id ($docitem.document.id)
    #end

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG

    Original Message:
    Sent: 10-07-2022 07:15
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    I'm trying to generate a report from a set of item types that includes a folder hierarchy. 

    I have set my report to be context sensitive so that $documentList includes all item types. However I am unable to return any fields at all through either $doc.getCustomFields() or $velocityReportUtil.getValueForField().

    I would greatly appreciate a generic example that simply iterates over the fields (picklists, string#, and integers) of an ContourItem and prints those out in an HTML velocity template.

  • Jeff Abbott
    Jeff Abbott Member, Data Exchange Posts: 31
    edited October 2022
    I have resolved my problem. I was preparing an example for Jama support when my sample script suddenly worked. I must have changed something since yesterday, but I don't know what that was.

    ------------------------------
    Jeff Abbott
    Leidos
    Orlando FL
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 10-10-2022 10:46
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    Right, sorry for the confusion.  I am setting $attachmentDao as follows:
    #set( $attachmentDao = $documentSource )

    Jeff

    ------------------------------
    Jeff Abbott
    Leidos
    Orlando FL
    ------------------------------

    Original Message:
    Sent: 10-10-2022 08:39
    From: Alessandro Valli
    Subject: Jama variables and tools available to Velocity Reports

    Hey Jeff, 
    are you using a Jama version < 8.42?

    DAOs are not available in newer versions.
    Here you can use $documentSource.getAttachment($mathTool.toInteger($nAttId))

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG

    Original Message:
    Sent: 10-10-2022 06:48
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    Thanks for the pointer Alessandro,

    I found my first problem which as not setting $doc = $vDoc.document.  To my surprise, the custom fields were also retrievable using $velocityReportUtil.getValueForField($doc, "req_list_type", $dateFormat ))
    However, my new challenge is not being able to access the attachments (figures) on each item. Neither of these two methods work for me:

    #set( $attachmentList = $attachmentDAO.getDocument_DocAttachments($mathTool.toInteger($docI.Id) )
    #set($attachmentId= $doc.getAttachment())

    Jeff

    ------------------------------
    Jeff Abbott
    Leidos
    Orlando FL

    Original Message:
    Sent: 10-08-2022 08:36
    From: Alessandro Valli
    Subject: Jama variables and tools available to Velocity Reports

    #foreach($docitem in $documentList)
    do something with $docitem.document
    or call a method from $documentSource by using the item id ($docitem.document.id)
    #end

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG

    Original Message:
    Sent: 10-07-2022 07:15
    From: Jeff Abbott
    Subject: Jama variables and tools available to Velocity Reports

    I'm trying to generate a report from a set of item types that includes a folder hierarchy. 

    I have set my report to be context sensitive so that $documentList includes all item types. However I am unable to return any fields at all through either $doc.getCustomFields() or $velocityReportUtil.getValueForField().

    I would greatly appreciate a generic example that simply iterates over the fields (picklists, string#, and integers) of an ContourItem and prints those out in an HTML velocity template.