Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

List view of comment field in a form view

Jim Rogers October 3, 2022

Hey all!

I have a Confiforms Form View that is accessed from either a Create or from an Edit Control via the Table View.   (Working perfectly).

I have added a Comment field (Comment data type) on the Form definition and Form View.  I am displaying the comments in a List view within the Form View of the individual entry/row.   Inputting a new comment works fine and is associated with the individual row.  

I have two issues - 

1 - List View within the Form View is displaying all comments across the data set.   It needs to filter (display) for the row in context but the syntax seems to be tricky.   I assume something like a filter in the List view like [entry.id]=[id] to get only the comments for the current record.   But I can't seem to make it work.  

2 - Also, the sorting by comment.timestamp DESC (to get the most recent comment to the top) only seems to sort by date but not time.

I assume this has already been solved as have comments for a given record, sorted by most recent is a common need.  Or if not, others could benefit.  

Thanks!   Jim

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2022

Hi @Jim Rogers 

ConfiForms FormView is usually shown when adding new records, and therefore there is nothing to "filter on"

I mean, what comments do you want to show for the new record? It should have none (as record does not exist yet)

Normally the filter by the "current record in the context" would be something like

id:[entry.id]

Alex

Jim Rogers October 3, 2022

Alex, 

Thank you for the response.  The primary use case is to Edit entries in the Data Set as we don't add them new very often.  So the Form View is primarily for record maintenance including adding "Progress and/or Update" comments.   Your above suggestion on using id:[entry_id] worked.  

Any thoughts on point #2 with sorting?   I am sorting in the list view (or table view) in the form with mycommentfield.timestamp DESC or mycommentfield.timestamp ASC and it doesn't have an impact.  It makes the most sense to have the most recent comment at the top of the list and everything below in reverse chronological order.  

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2022

ConfiForms can sort records within the form as you like, but it cannot sort the values within it's field. As I understand you want to sort the comments within a comment field... not sure why you need that (they are sorted already by the field itself), but it is not possible to override

Jim Rogers October 11, 2022

Alex,

We are now successfully using the comment field type across our projects!   Just an enhancement request to make it more useful. 

1 - An option to sort in reverse chronological order to show the latest comments first. 

2 - An option to limit the number of comments displayed.  For example, to show the latest 2 updates to limit the view the latest entries but not the entire comment history. 

Thanks,

Jim

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2022

Hi @Jim Rogers 

Thank you for your feedback.

Not the best place to collect it (better to open a support ticket with us), but I appreciate it very much.

Alex

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2022

What you can do already now.. and this is a "bit" scary... is to have the following expression

Assuming the "Comment" field is named "commentField"

[entry.commentField.sort(timestamp DESC).limit(2).iterateAndPrint([entry.content] <br/>).unescape.renderAsHtml] 

 Sorting by comment timestamp DESC, and limiting to only 2 comments and then.. iterating through and printing the contents

Alex

Sai Daliboina March 1, 2023

Hi, 

I would like to know how to implement the comment field with a sort in reverse chronological order to show the latest comments first ? 

Thanks,

Sai

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events