Product Idea

 View Only
  • 1.  Upstream Relationships for a specific Item (velocity)

    Posted 11-25-2021 13:05
    Hi all,

    I am looking to collect a certain upstream item type, but can't seem to configure the function properly.

    I have been using the below for Downstream Items and that works perfectly:
     #foreach($h1 in $documentSource.getRelationshipsForDocumentAndType($InputRef.getId(),186,true))
    ## additional code here
    #end


    ​​​

    ------------------------------
    Alex Wilson
    Auckland
    ------------------------------


  • 2.  RE: Upstream Relationships for a specific Item (velocity)

    Posted 11-25-2021 13:30
    Hello Alex,
    I normally use
    • $documentSource.getDownstreamDocumentIds()
    • $documentSource.getUpstreamDocumentIds()
    or also
    • $documentSource.getRelationshipBetweenDocuments()
    No issues so far. Maybe you can get the list and then check for the item type ...

    Best,

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



  • 3.  RE: Upstream Relationships for a specific Item (velocity)

    Posted 11-25-2021 13:43

    Hi Alessandro, Do you mean something like the following?

    #macro ($Function $InputRef $ListofDocs)
         #foreach($upstreamDoc in $documentSource.getUpstreamDocumentIds($InputRef.getId()))
              #if($186 == $documentSource.getDocumentTypeIdFromDocId(upstreamDoc .id)
                   #SuppressReturn($ListofDocs.add($upstreamDoc.getToDocument()))

    #end
    #end
    #end

    where:
    #macro(SuppressReturn $command) #set($temp = $command) #end



    ------------------------------
    Alex Wilson
    Fisher and Paykel Healthcare
    Auckland
    ------------------------------



  • 4.  RE: Upstream Relationships for a specific Item (velocity)

    Posted 11-29-2021 12:23
    Hi Alex,
    sorry for answering late, but now!
    getUpstreamDocumentIds is returning an ID -> upstreamDoc.id won't work.
    Just check the documentation -> Jama Software - Velocity engine
    Best,
    Alessandro

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