Creating a velocity report and including tags for items... Not same as other question that is lik

Scott Allen
Scott Allen Member Posts: 4

Hello,

I'm trying to modify an existing Velocity Report .vm file.  I am able to add fields and move them around, but I want TAGS to also be part of the report for each item that has tags...  

Attached is a segment of the .vm file I am using.  Look for where Scott (me) adds two fields, one of which is "tags".

thanks.

------------------------------
Scott Allen
Jet Propulsion Laboratory
Pasadena CA
------------------------------

Comments

  • Patrick Szabo
    Patrick Szabo Member, Medical Devices & Life Sciences Solution Posts: 55
    edited July 2023

    to get a list of all the tags of an item, you can try the following:

    #set( $tagDao = $documentSource )
    
    #set( $tagList = "")
    #set( $docTags = $tagDao.getAllTagsByDocumentId( $doc.id))
    #foreach( $dt in $docTags)
          #if( $foreach.first )
            #set( $tagList = "$dt.tagName")
          #else
            #set( $tagList = "$tagList, $dt.tagName")
          #end
    #end

    And then use the $tagList in your code. This should create a list of the tags like this:

    tag1, tag2, tag3



    ------------------------------
    Patrick
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 07-07-2023 12:48
    From: Scott Allen
    Subject: Creating a velocity report and including tags for items... Not same as other question that is like this...

    Hello,

    I'm trying to modify an existing Velocity Report .vm file.  I am able to add fields and move them around, but I want TAGS to also be part of the report for each item that has tags...  

    Attached is a segment of the .vm file I am using.  Look for where Scott (me) adds two fields, one of which is "tags".

    thanks.



    ------------------------------
    Scott Allen
    Jet Propulsion Laboratory
    Pasadena CA
    ------------------------------

    Patrick
  • Scott Allen
    Scott Allen Member Posts: 4
    edited July 2023

    OMG Thank you.  It worked.

    Scott

    ------------------------------
    Scott Allen
    Jet Propulsion Laboratory
    Pasadena CA
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 07-10-2023 07:04
    From: Patrick Szabo
    Subject: Creating a velocity report and including tags for items... Not same as other question that is like this...

    to get a list of all the tags of an item, you can try the following:

    #set( $tagDao = $documentSource )#set( $tagList = "")#set( $docTags = $tagDao.getAllTagsByDocumentId( $doc.id))#foreach( $dt in $docTags)      #if( $foreach.first )        #set( $tagList = "$dt.tagName")      #else        #set( $tagList = "$tagList, $dt.tagName")      #end#end

    And then use the $tagList in your code. This should create a list of the tags like this:

    tag1, tag2, tag3



    ------------------------------
    Patrick
    ------------------------------

    Original Message:
    Sent: 07-07-2023 12:48
    From: Scott Allen
    Subject: Creating a velocity report and including tags for items... Not same as other question that is like this...

    Hello,

    I'm trying to modify an existing Velocity Report .vm file.  I am able to add fields and move them around, but I want TAGS to also be part of the report for each item that has tags...  

    Attached is a segment of the .vm file I am using.  Look for where Scott (me) adds two fields, one of which is "tags".

    thanks.



    ------------------------------
    Scott Allen
    Jet Propulsion Laboratory
    Pasadena CA
    ------------------------------