Comment function on my meetings

In your Update record flow, you’re using current.id as the ID for the record to be updated, but current.id is the comment’s id, not the meeting’s id. Should it be data.Termine1.id instead?

Yes i choosed current id, because i thought i have to choose this one because the record to this id should be updated. But maybe i have to update the full record and not only the comment part :man_shrugging:

I changed it to the data.Termine1.id and now it works.
So now i will look on editing records. I think it have to work same way.
Edit: You’ve written i have to use SET_ITEM to edit a record. But the Editor don’t know this formula. Which one do i have to use instead of this?

For now if i create or delete a comment it is only shown if i reload the page after creating / deleting. Is there a flow function or anything else i can set that the page is automatically reloaded after creating / deleting that the change of the record is shown directly?

For the automatic reload, I think you can try two options:

1st option: In the data variables tap, open the logic canvas for the data variable Termine1 (picture below). There you should see the delay node, with the property Time to wait. It should be by default 5000 milliseconds, so every 5 seconds the object is updated, so after 5 second after the deletion the comment should disappear. Is this the case with your app? In that case, you can shorten the time in the delay to get the updated comments to show faster.

2nd option if the 1st doesn’t work: After the deletion/creation/editing of a comment, you can repeat the Get record - Set data variable for Termine1, identical to the flow in the logic canvas in the data variables tab. This way every time a comment is deleted/created/edited, the app fetches the data.Termine1 and should get the updated comments.

Let me know how these work for you!

And yes, the editing will also work similar to adding and removing comments, just the formula will be different. Instead of SET_ITEM you can use SET_KEY. However, this formula returns an object, not a list of objects, as you might notice from the formula editor’s documentation about SET_KEY. So I would recommend your editing formula would MAP through the list of comments, and within the mapping use IF() to check if the list item’s id matches the edited (current) comment’s id, and in that case use SET_KEY to change the value of the text property.

I tried and the first option does not work. But the second one works for creating a comment. But not for deleting one. After deleting it, it’s still shown.
But in this case i found another problem. Before i only tried to have one comment. But now i tried to creat a second one and there is the problem. When i finish creating it, it relpaces the already created comment. So everytime there is only one comment and the other one is getting away after creating / adding a new comment. But it should be possible to add more than one comment to a meeting.
Edit: I found a solution that more than one is shown. I set this formula WITH_ITEM(data.Termine1.kommentare, {text: pageVars.comments, id: GENERATE_UUID()}) at object with properties instead\kommentare of setting id to GENERATE_UUID and text to pageVars.comments at object with properties\kommentare\List of Values. But it does not work as it should. I can only create a comment if already exists another one. But if there is already a comment it works fine.

For the SET_KEY part, i don’t know how to build this formula :sweat_smile:
Maybe sth. like this? IF(MAP(data.Termine1.kommentare, transformFormula), SET_KEY(object, propertyName, value), falseValue) :man_shrugging:

So if I understand correctly you can only create and show a new comment if there are existing comments for the meeting? Is the issue in creating new comments or in showing all comments, do you get an error in creating comments?

As for the SET_KEY, we’re actually soon releasing new formulas which will make editing an object in a list much easier :grin: but until that the mapping would go something like this:

MAP(data.Termine1.kommentare, IF(item.id == current.id, SET_KEY(item, "text", new_text), item))

So basically this maps through all comments for the meeting, and for each comment it checks if the id matches the current edited comment. If it matches, then it modifies the text property using SET_KEY, otherwise it does nothing.

For the first paragraph: no there is no error. It says that it is successful created (my alert on the positive output)

The rest:
Easier sounds good👍
I will try later when I’m home from school.

Alright, the issue seems to be with showing the comments then. How does your repeat with look like? It should work with just repeating with data.Termine1.kommentare :thinking:

Now we have the new formulas! So now there is a formula function SET_ITEM_AT which would serve your purpose

SET_ITEM_AT(data.Termine1.kommentare, INDEX_OF(data.Termine1.kommentare, current), SET_KEY(current, "text", new_text))

SET_ITEM_AT takes a list, an index for what item should be replaced, and with what to replace that item. Here we use the list data.Termine1.kommentare, get the index of the edited comment with INDEX_OF, and use SET_KEY to replace it with an otherwise similar comment, just with a new text property.

So i set the last thing and got no error. But i can’t test in preview because of the problem above.
Yes, i just repeating the container with data.Termine1.kommentare.

Hmm odd, I’ll take a look at your app, seems like everything should be in place! so just a moment :slightly_smiling_face:

1 Like

I can’t seem to see any meetings in the calendar view when I logged in as demo user and clicked on a date that has a dot under it. Is there some user right differences here?

One idea you might try to display all meetings is to instead of using repeat with Termine1.kommentare to change the repeat with binding to a formula and use LOOKUP instead:

LOOKUP(data.Termine1, "kommentare")

This has sometimes solved a similar issue for others.

I also don’t know what the problem is with meetings shown. There are no user differences (Don’t know how to build sth like that a clean way except looking if the username is the same one i predefined for e.g. visble or not) At my Android preview it’s been working but on web preview it doesn’t. And also on published website it does not work. But i don’t know what it could be, because i didn’t change anything since it worked. Since there were the new flow function updates, etc. it does not work correctly. So maybe that’s the problem.

Edit: But if i change the formula between Formula LOOKUP(data.Termine1, "kommentare") or dataVars data.Termine1.kommentare it sometimes works and sometimes doesn’t work.
After only changing the repeat with between this both now it’s also not working on android most times.
Don’t know. I didn’t change anything else now. And the time there was a meeting shown, i tried to use the comment function, but same problem as above. The comment is not shown if there is no other comment already shown.

Hi!

Sorry fo the wait! Apparently there has been an issue with updating lists and repeat-with, which should be now fixed with the new release. Is it still not working after updating all components and flow functions?

On the main page of the forum there is a pinned comment about some known issues with the new release, can you find something there that would affect your app?

Yes, some of them are listed in the pinned comment.

For your first paragraph: For now, the problem still exists, but i also have no updates shown in marketplace, so i couldn’t update my components and flow functions. Maybe that’s the problem.

Hi,
For now it’s still not possible to create a comment. I know it’s created because i set a toast at the positive output. But its not shown. The problem as written above. So it maybe would be a still existing bug. Maybe an other one than in the pinned comment written. Because in the written comment it says that the mentioned ones are fixed.

Hey! Sorry for the silence on my end :weary:

What version of the AppGyver preview app are you using? There were some issues with repeat-with and formulas, but most of them should be fixed as of a few days ago.

So just as a recap for your current situation: comment creation works, but new comments automatically show up on the meeting only when the meeting has previous comments too?

So if you add the first comment to a meeting, that doesn’t show up at all? Or does it show when you exit the page and return?

Sorry for the many questions, this just seems like a weird bug so I’m trying to get all the details to pinpoint in what phase something goes wrong :grin: thanks for your patience so far!

No problem :+1:

I’m using the newest one of the preview apps. But i also tried with appgyver legend. Same problem.

comment creation works, but new comments automatically show up on the meeting only when the meeting has previous comments too.
So if you add the first comment to a meeting, that doesn’t show up at all.

That’s it…

Hmm alright. Maybe it has something to do with how the comments of each meeting are initialized. The only difference between these two use cases is that you are adding the first comment of a meeting to an empty list, and that you are adding more comments to an existing list. If a meeting’s comments is undefined before you add any comments to it, it could cause problems when you try to add and show new comments :face_with_monocle:

When a meeting is created, how is the property kommentare defined? If you have not done this already, I would suggest initializing it with an empty list [] and see if that would help. Let me know how it goes!

How do i initialize with an empty list? I tried to initialize it at my data ressource multiple ways. But nothing works. Is it right, how i’ve done it?

Hey!

You don’t need to change anything in the data tab. When a meeting is created, in the Create Record node you can set the property kommentare as [] via a formula, for example.