I am unable to get the sortTool working
#set( $revHistTypeId = 144)Note that changing the last line to:
#set($revList = [])
#set( $revHistoryDocInfoList = $documentSource.getDocumentInfoList($revHistTypeId, $project.id, 200) )
#foreach( $docInfo in $revHistoryDocInfoList )
#set ( $revDoc=$documentSource.getDocument($docInfo.id))
#set ( $success=$revList.add($revDoc))
#end
#set($sortedList = $sortTool.sort($revList,["revision_date"]))
#set($sortedList = $sortTool.sort($revList,"revision_date"))Does not help.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
Comments
-
Hi Jeff,
So that we can take a deeper look into this, can you open a Support ticket and reference this thread in the ticket description (as well as your version/type of Jama and any other pertinent info) on it, please?
Thank you!
------------------------------
Carly Rossi // she/her
Community Manager // Jama Software
Portland, OR
------------------------------
-------------------------------------------
Original Message:
Sent: 02-07-2023 12:16
From: Jeff Abbott
Subject: I am unable to get the sortTool working
I have this script snippet below. The $revList contains my itens, however I get nothing returned to my $sortedList:#set( $revHistTypeId = 144)
Note that changing the last line to:
#set($revList = [])
#set( $revHistoryDocInfoList = $documentSource.getDocumentInfoList($revHistTypeId, $project.id, 200) )
#foreach( $docInfo in $revHistoryDocInfoList )
#set ( $revDoc=$documentSource.getDocument($docInfo.id))
#set ( $success=$revList.add($revDoc))
#end
#set($sortedList = $sortTool.sort($revList,["revision_date"]))#set($sortedList = $sortTool.sort($revList,"revision_date"))
Does not help.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
0 -
Peter Lampacher Member, Jama Connect Interchange™ (JCI), Jama Validation Kit (JVK) + Functional Safety Kit (FSK) Posts: 14Hi Jeff!
You are trying to sort document objects, but these do not have a "revision_date" property. This is probably why it fails.
#set($sortedList = $sortTool.sort($revList,"createdDate")) will work. Or any other (sortable) property on document objects.
Regards,
------------------------------
Peter Lampacher
MED-EL
Innsbruck
------------------------------
-------------------------------------------
Original Message:
Sent: 02-07-2023 12:16
From: Jeff Abbott
Subject: I am unable to get the sortTool working
I have this script snippet below. The $revList contains my itens, however I get nothing returned to my $sortedList:#set( $revHistTypeId = 144)
Note that changing the last line to:
#set($revList = [])
#set( $revHistoryDocInfoList = $documentSource.getDocumentInfoList($revHistTypeId, $project.id, 200) )
#foreach( $docInfo in $revHistoryDocInfoList )
#set ( $revDoc=$documentSource.getDocument($docInfo.id))
#set ( $success=$revList.add($revDoc))
#end
#set($sortedList = $sortTool.sort($revList,["revision_date"]))#set($sortedList = $sortTool.sort($revList,"revision_date"))
Does not help.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
0 -
Thanks Peter, how to I sort by a custom date field?
Note, I only have to sort because the documents are not returned in the order they are displayed.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
-------------------------------------------
Original Message:
Sent: 02-07-2023 23:40
From: Peter Lampacher
Subject: I am unable to get the sortTool working
Hi Jeff!
You are trying to sort document objects, but these do not have a "revision_date" property. This is probably why it fails.
#set($sortedList = $sortTool.sort($revList,"createdDate")) will work. Or any other (sortable) property on document objects.
Regards,
------------------------------
Peter Lampacher
MED-EL
Innsbruck
------------------------------
Original Message:
Sent: 02-07-2023 12:16
From: Jeff Abbott
Subject: I am unable to get the sortTool working
I have this script snippet below. The $revList contains my itens, however I get nothing returned to my $sortedList:#set( $revHistTypeId = 144)
Note that changing the last line to:
#set($revList = [])
#set( $revHistoryDocInfoList = $documentSource.getDocumentInfoList($revHistTypeId, $project.id, 200) )
#foreach( $docInfo in $revHistoryDocInfoList )
#set ( $revDoc=$documentSource.getDocument($docInfo.id))
#set ( $success=$revList.add($revDoc))
#end
#set($sortedList = $sortTool.sort($revList,["revision_date"]))#set($sortedList = $sortTool.sort($revList,"revision_date"))
Does not help.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
0 -
My 'hack' solution is to iterate the list in reverse since that is the order it is returned in using
#set ( $revDoc=$documentSource.getDocument($docInfo.id)
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
-------------------------------------------
Original Message:
Sent: 02-07-2023 23:40
From: Peter Lampacher
Subject: I am unable to get the sortTool working
Hi Jeff!
You are trying to sort document objects, but these do not have a "revision_date" property. This is probably why it fails.
#set($sortedList = $sortTool.sort($revList,"createdDate")) will work. Or any other (sortable) property on document objects.
Regards,
------------------------------
Peter Lampacher
MED-EL
Innsbruck
------------------------------
Original Message:
Sent: 02-07-2023 12:16
From: Jeff Abbott
Subject: I am unable to get the sortTool working
I have this script snippet below. The $revList contains my itens, however I get nothing returned to my $sortedList:#set( $revHistTypeId = 144)
Note that changing the last line to:
#set($revList = [])
#set( $revHistoryDocInfoList = $documentSource.getDocumentInfoList($revHistTypeId, $project.id, 200) )
#foreach( $docInfo in $revHistoryDocInfoList )
#set ( $revDoc=$documentSource.getDocument($docInfo.id))
#set ( $success=$revList.add($revDoc))
#end
#set($sortedList = $sortTool.sort($revList,["revision_date"]))#set($sortedList = $sortTool.sort($revList,"revision_date"))
Does not help.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
0 -
Peter Lampacher Member, Jama Connect Interchange™ (JCI), Jama Validation Kit (JVK) + Functional Safety Kit (FSK) Posts: 14
Hi Jeff!
How to I sort by a custom date field?
Retrieve the custom field values, find the right one and sort (possible with some extra code). The easier way would be to use a predefined date field (date1...date5) as these are directly accessible as document properties.
If you want the items sorted as they are displayed in the Jama explorer: Retrieve the corresponding documentNode objects. These have sortOrder and globalSortOrder properties.
Regards,
------------------------------
Peter Lampacher
MED-EL
Innsbruck
------------------------------
-------------------------------------------
Original Message:
Sent: 02-08-2023 06:45
From: Jeff Abbott
Subject: I am unable to get the sortTool workingThanks Peter, how to I sort by a custom date field?
Note, I only have to sort because the documents are not returned in the order they are displayed.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
Original Message:
Sent: 02-07-2023 23:40
From: Peter Lampacher
Subject: I am unable to get the sortTool working
Hi Jeff!
You are trying to sort document objects, but these do not have a "revision_date" property. This is probably why it fails.
#set($sortedList = $sortTool.sort($revList,"createdDate")) will work. Or any other (sortable) property on document objects.
Regards,
------------------------------
Peter Lampacher
MED-EL
Innsbruck
Original Message:
Sent: 02-07-2023 12:16
From: Jeff Abbott
Subject: I am unable to get the sortTool working
I have this script snippet below. The $revList contains my itens, however I get nothing returned to my $sortedList:#set( $revHistTypeId = 144)
Note that changing the last line to:
#set($revList = [])
#set( $revHistoryDocInfoList = $documentSource.getDocumentInfoList($revHistTypeId, $project.id, 200) )
#foreach( $docInfo in $revHistoryDocInfoList )
#set ( $revDoc=$documentSource.getDocument($docInfo.id))
#set ( $success=$revList.add($revDoc))
#end
#set($sortedList = $sortTool.sort($revList,["revision_date"]))#set($sortedList = $sortTool.sort($revList,"revision_date"))
Does not help.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
0 -
Thanks Peter, I'll switch to use the date1.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
-------------------------------------------
Original Message:
Sent: 02-08-2023 23:29
From: Peter Lampacher
Subject: I am unable to get the sortTool workingHi Jeff!
How to I sort by a custom date field?
Retrieve the custom field values, find the right one and sort (possible with some extra code). The easier way would be to use a predefined date field (date1...date5) as these are directly accessible as document properties.
If you want the items sorted as they are displayed in the Jama explorer: Retrieve the corresponding documentNode objects. These have sortOrder and globalSortOrder properties.
Regards,
------------------------------
Peter Lampacher
MED-EL
Innsbruck
------------------------------
Original Message:
Sent: 02-08-2023 06:45
From: Jeff Abbott
Subject: I am unable to get the sortTool workingThanks Peter, how to I sort by a custom date field?
Note, I only have to sort because the documents are not returned in the order they are displayed.
------------------------------
Jeff Abbott
Leidos
Orlando FL
Original Message:
Sent: 02-07-2023 23:40
From: Peter Lampacher
Subject: I am unable to get the sortTool working
Hi Jeff!
You are trying to sort document objects, but these do not have a "revision_date" property. This is probably why it fails.
#set($sortedList = $sortTool.sort($revList,"createdDate")) will work. Or any other (sortable) property on document objects.
Regards,
------------------------------
Peter Lampacher
MED-EL
Innsbruck
Original Message:
Sent: 02-07-2023 12:16
From: Jeff Abbott
Subject: I am unable to get the sortTool working
I have this script snippet below. The $revList contains my itens, however I get nothing returned to my $sortedList:#set( $revHistTypeId = 144)
Note that changing the last line to:
#set($revList = [])
#set( $revHistoryDocInfoList = $documentSource.getDocumentInfoList($revHistTypeId, $project.id, 200) )
#foreach( $docInfo in $revHistoryDocInfoList )
#set ( $revDoc=$documentSource.getDocument($docInfo.id))
#set ( $success=$revList.add($revDoc))
#end
#set($sortedList = $sortTool.sort($revList,["revision_date"]))#set($sortedList = $sortTool.sort($revList,"revision_date"))
Does not help.
------------------------------
Jeff Abbott
Leidos
Orlando FL
------------------------------
0