Question relating to "Generate a list from the bottom up" (Custom chat screens)

I have been trying to figure this one out.

I’m having the same problem that @Neker is having here:

When there are a lot of messages between 2 users, the message screen pretty much has a seizure on its way down to the newest message.

On a related post, @KevinC stated he may have come up with a work-around using adalo’s API but I have no idea how.

Anyone come up with a solution for this yet (and willing to share how to accomplish it?)

1 Like

Bump! I’m trying to use the adalo’s api to create external collections for the chat but I’m not sure how to filter the api data to show the correct conversation/messages based on the users.

So like, how can I filter the conversations by conversation members ids and then filter the messages by conversation id?

Conversations:


Messages:

If it’s possible, I’d like to know how to query by the individual parameters so that I can display the information to the right people, because right now it’s a list of ALL messages to all users.

If possible, could the Adalo API documentation also show how to query individual parameters within the array?

Either that or is it possible to figure out a way to do offset/limit with an internal collection?

I figured it out! I believe I am now worthy of being called an Adalo Expert!

I ditched the idea of using Adalo’s API to get the messages, was way too complicated to try to pull and filter the values.

So here’s how I did it.

2 collections: Conversations and Messages

I added a number parameter to the “Conversations” collection called “Offset Count”
and added a number parameter “Message #” to the message collection.

When a new message is sent, the new message created action adds the current conversation > message # as “Current conversation > Message # > Maximum + 1” and an additional action to update the current conversation to have the Maximum + 1 for the offset count.

Then, I added 3 input fields to the Messages screen.
Default value for input 1: Current conversation > Offset Count
Default value for input 2: Custom formula > (Input 1) -7
Default value for input 3: Custom formula > (Input 2) -7

Then I added the Messages list with and filtered Current Conversation > Messages to only get the messages of the current conversation.
Another filter that says “Message #” is between Input 2 (lower number) and Input 1 (maximum message # +1)

Added a button on the top of the list that says “Previous Messages”. When clicked, change the value of Input 2 to the value of Input 3 to subtract 7 from the current lower number offset. When clicked, the Input 2 drops by 7 and so does Input 3.

Hide all 3 input fields with a rectangle over them.

Works like a charm.

2 Likes