How do I load the last 50 messages


to save loading time on my chat app I just want it to load the last 50 messages. Do you know how I could do this? I’m ok with work around options

have you tried to assign the maximum of visible items in the list?

First, if you don’t already, add a Number parameter to the Messages collection. When a message is sent, ensure that you have a unique number set for each message. This will keep the count of the messages in sequential order.

Like this:

Make sure that the count is set by the conversion.
This will be “Current Conversation > Messages > Count + 1”

Like this:

Next
Add 3 input components to your chat screen.

Relabel them like so:
Input 1 = Total Message Count Input
Input 2 = Message Count +1 Input
Input 3 = Message Count -8 Input
Input 4 = Show More Input

Set the default value for “Total Message Count Input” to “Current Conversation > Messages > Count”

Set the default value for “Message Count +1 Input” to “Custom Formula” and insert “Other Components > Total Message Count Input +1” inside the custom formula.

Set the default value for “Message Count -8 Input” to “Custom Formula” and insert “Other Components > Total Message Count Input -8” inside the custom formula.

Set the default value for “Show More Input” to “Custom Formula” and insert “Other Components > Message Count -8 Input -5” inside the custom formula.

On your messages list, set a filter where Message ID is between “Message Count -8 Input” and “Message Count +1 Input”

Like this:

Next, you can add a button above the messages and set the text to “Load More Messages”

Then, you can hide the ‘load more’ button by setting visibility settings where the button is sometimes visible if current conversation > messages > count is equal to zero with a custom filter where message ID is less than “Message Count -8 Input”

Like this:

The last step is to hide the 4 inputs. You can do this by placing a rectangle over them or by setting the input colors to transparent and disabling the background/border.

how should I code the load more messages button. I was thinking about a similar method but I thought I was going to have to use a seperate page

also that wouldn’t really revert back if the user left the page right?


wait how were you able to get a math function in their I haven’t been able to do that

oh thats just the name of it sorry

Yes, it does. If you click “Back” and then click into the conversation, the custom formulas reset the counts.

All formulas are in the inputs. You then fill the filters with the input component values via Other Components > Inputs

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.