Comment function on my meetings

I have a calendar. If you click on an calendar entry in list, it opens its full informations in a new page. I want my users to be possible to add comments to exact this meeting. I already added a comment entry at my database, as a list of text.
How am i now possible to let my users create this comments to exactly this meeting? They also should have the ability to delete their own comments. And how can i show all the comments at my meeting page that the users are able to see all of them?

any ideas on this? :sweat_smile:
i know that i am asking much questions…

Hey!

Is your comment entry databse as its own database, or do you have a property “comments” in your meeting database?

If the comments are its own database, I would suggest using a list of objects instead of list of texts. The comments could have the following schema:

commentEntry {
    id
    comment
    userId
    meetingId
}

This way you can find and show all comments to a certain meeting using the meetingId property, and add the possibility to delete a comment if the userId property matches with the current user.

Another option is to add a commentEntries property to your meeting database. That way you have direct access to a meeting’s comments from the meeting object. The commentEntries property could be a list of objects with the properties comment and userId

Hi,

It’s a part at the meeting database. I already add a list of objects to this database like you have explained.
But I don’t know how to repeat them at an view component and how to later update or delete the records…
If I e.g. try to get the data to an paragraph it only always said that a list of objects type is not assignable to a text type and so on. I also tried some other components but every time the same failure.
Basically I just want to be possible to have the option to add comments to the current meeting in my meeting view (A page that shows all data of the record) and also be possible to edit or delete them if they are from the actual user.
Thanks for looking into it.

All of these actions should be possible with the help of formulas.

For the repeat with, try using a formula, something along the lines of:
LOOKUP(selectedMeeting, "commentEntries") or a dot notation selectedMeeting.commentEntries

When that is set as the repeat-with, you should be able to bind the paragraph as current.comment as usual.

As for adding, deleting, and updating comments formulas can come in handy too.For deletion maybe REMOVE_ITEM you can use the current.id of the comment to exclude it from the meeting’s comment list. To add a comment, you can use WITH_ITEM to add a new comment object to the meeting’s comment list. As for updating a comment, perhaps SET_ITEM could work with the help of the current.id in the repeating comment list.

So when a user clicks save, delete, or update on a comment you should add logic to update the whole meeting object using the Update record flow function. Then use the selectedMeeting id to determine which record to update, and then modify the comments property with the help of those above mentioned formulas.

Thanks.
For the first part, do i need to use the data Variable for that?
i tried data.Termine1.kommentare and also LOOKUP(data.Termine1, "kommentare").
But with both i were not able to bin the paragraph to currently repeated property value. This option were not shown. And at the formula editor in the repeat with part, it says that List items are incompatible.

Hmm that’s odd. The binding of comments to repeat-with works but binding the comment content to a paragraph did not work?

data.Termine1 should be a single data record, kommentare should be a list of objects, and the content of the comment should be text to be able to bind it to a paragraph. If this is the case then you can provide me with your app id (found in the url of your app) so I can take a closer look, everything sounds like it should work!

Hi,
So after your explanation, i got it to work.
But now i have the next Problems. :see_no_evil:
The send icon has the update record logic. I set Update Records “Record properties” to the formula in the second picture. But i got an error. Nevertheless i tried to use it, but it does not work.
The pageVars.comments variable is text type and the data.Termine1.kommentare database part is an list of objects (id and text - both as text type)

Is the id that is needed for SET_ITEM and REMOVE_ITEM automatically created at WITH_ITEM, when i update the data record? And how does the update record function know that it have to set the text of pageVars.comments to data.Termin1.kommentare.text and not to data.Termine1.kommentare.id?
Opera Momentaufnahme_2020-12-05_172736_platform.appgyver.com Opera Momentaufnahme_2020-12-05_172759_platform.appgyver.com

Hey!

Alright so pageVars.comments is a new comment of a text type the user is sending? In that case:

If you’re appending an item to a list of objects with WITH_ITEM, the item needs to be an object too and have the same schema as the resource you are adding it to. The id is not automatically created in WITH_ITEM. You can generate an id for example with the GENERATE_UUID() formula function. So your WITH_ITEM formula would look something like this:

WITH_ITEM(data.Termine1.kommentare, {text: pageVars.comment, id: GENERATE_UUID()})

In this formula you create the object using the {...} brackets, and you set the properties correctly, so that the correct info goes to the correct property!

Hi, it solved the first error. But it still says that list type is not assignable to object type.
Opera Momentaufnahme_2020-12-07_160819_platform.appgyver.com

How does the logic flow for the Update Record look like?

The update record’s properties should be as follows:

Resource Name should be your meetings database
The ID should be the selected meeting’s ID, I’m guessing something like data.Termine1.id
And the record properties should be bound to “Custom object”, in which you can determine the kommentare property to be the WITH_ITEM formula.

In this case, you only want to update the kommentare property of the meeting object. If you have bound the record properties to that formula, it won’t work because the editor will think you are updating the whole meeting object to be the WITH_ITEM formula. Since that returns a list it can’t be assigned to an object.

so for now my logic for update record is this:
(the record properties formula is still the same as in my last post)
Opera Momentaufnahme_2020-12-08_154527_platform.appgyver.com Opera Momentaufnahme_2020-12-08_154510_platform.appgyver.com

I can’t find the binding “Custom object” at the record properties part.
My App-ID: 177865
(It’s the page “Terminansicht” if you want to look at this)

Oh yes it’s actually called “Object with properties”, like in this screenshot

Now clicking on that custom object you should be able to bind values property by property to your meeting object.

1 Like

so creating a comment now works. Thanks :+1: :+1: :+1:
So now editing and deleting record are left.
You’ve written i have to use WITHOUT_ITEM and SET_ITEM. But it looks quite more difficult to set up. Because it still says that List type is not assignable to object type. So it looks like that fomula does not work.

Hmm sounds like the same error as was first with the WITH_ITEM, do you have the right properties for the update record in those cases: binding the record properties to object with properties and then adding those formulas to the meeting object’s kommentare property?

same problem. Maybe you can look into it directly? My App-ID is in my last post above.
Opera Momentaufnahme_2020-12-08_161513_platform.appgyver.com

The WITHOUT_ITEM takes as parameters a list and an item from the list to delete. current.id + current.text is not an object, it’s just two texts added together.

So as you did with the WITH_ITEM you’ll need to create an object of the current.id and the current.text and give that as the second parameter.

I only get some error messages on everything i try.
E.g. i tried this formula: WITH_ITEM(data.Termine1.kommentare, WITHOUT_ITEM(data.Termine1.kommentare.text, current.text))

The WITHOUT_ITEM is identical to WITH_ITEM, it just removes instead of adds. So the formula is similar:

WITHOUT_ITEM(data.Termine1.kommentare, {text: current.comment, id: current.id})

So i now set this formula and there was no error message in editor. But in preview i get an error if i click on delete icon. The Error Message is only [object object].
WITHOUT_ITEM(data.Termine1.kommentare, {text: current.text, id:current.id})
Opera Momentaufnahme_2020-12-08_161513_platform.appgyver.com Opera Momentaufnahme_2020-12-08_172057_platform.appgyver.com Opera Momentaufnahme_2020-12-08_172108_platform.appgyver.com