Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Displaying Comment Count on Card View and Ordering by Two Dates

Hi everyone,

I'm building an AppSheet app with two data sources:

  • Notes: note_id, note_title, note_text, note_date
  • Comments: comment_id, note_id, comment_text, comment_date

Notes are displayed in a card view.

I'd like to show the number of comments on each card and order the notes by both note_date and comment_date. I'm having trouble finding a solution. Is this possible?

 

Solved Solved
0 5 203
2 ACCEPTED SOLUTIONS


@exerlanda wrote:

I'd like to show the number of comments on each card


In the Notes table you would have a column called say [Related Notes] .

Please add another virtual column in the Notes table called say [Comments_Count] with an expression something like COUNT([Related Notes]) .  [Comments_Count]  will capture the number of comments for that note. Display that column in the Notes card view.


@exerlanda wrote:

order the notes by both note_date and comment_date. I'm having trouble finding a solution. Is this possible?


 


@exerlanda wrote:

both note_date and comment_date.


 

Please add a virtual column called say [Latest_Comment_Date] in the Notes table with an expression something like 

MAX([Related Comments][Comment_Date])

where [Comment_Date] is the date column in the comments table.

Please create two card views

1. "Notes by Note date" . Use [Notes_Date] in the Notes table to sort descending that card view.

2. "Notes by Comment date" . Use [Latest_Comment_Date] in the Notes table to sort descending that card view.

Suvrutt_Gurjar_0-1736478493798.png

 

 

View solution in original post

Hi Suvrutt_Gurjar,

Thank you, it works fine.

I added a virtual column in notes called "comment_last_dateTime" with the formula MAX([Related comments][comment_dateTime]), and I keep only one view but I added two "sort by". The first one by "comment_last_dateTime" and the second by "note_date". I set "comment_dateTime = NOW()" by default, then everytime a comment is written, it is listed on the top. Great thank you for the help.

And for the count, I used the same idea, I created another virtual column called "comment_count" with the formula "COUNT([Related comments][comment_id])" and customize the layout to show the column in the card.

Wonderfull. Adding usermail as "note_name", it's create a perfect simple note taking app.

Thank you again.

View solution in original post

5 REPLIES 5
Top Labels in this Space