A process that retrieves values from a database and cannot be retrieved in a single run

We are placing an HTML element in a popup and attempting to perform the process described in the HTML element when the popup is opened.

The HTML element describes the process of extracting 200 items from approximately 1000 items of data in the database and logging them.

The actual process is used in our business, so we cannot show it here, but the image is as follows.
We have narrowed it down to 200 cases with a state called groupId.

When this process is executed, we assumed that the log to be displayed would be as follows.

200

However, the log actually displayed is as follows.

80
200

If you narrow it down to 10 cases, the result is as expected.

10

I can see that I finally retrieved 200 data, but why is the process of retrieving values from the database being done multiple times?

Also, most of the time I get 200 data, but sometimes I don’t get 200.

What is the cause of these problems?
And is there any way to retrieve all 200 data at once without having to run the process multiple times?

Please let me know if you know.

Are you sure you’re not calling some other console.log() method somewhere else?

No, console.log() is not elsewhere.

When a HTML element has dynamic data in it, the element becomes reactive, which means it gets run every time the dynamic data is updated. Loading data gives partial results as part of this.

You could try adding a conditional which looks at the last item, it might delay the update until all the data is ready.

An alternative approach is run the script from a workflow, where you have more control over when it is run.

1 Like

Thanks for the response.

The process of updating data is not implemented during the process of retrieving data.

Also, what exactly does “a conditional which looks at the last item” mean?
I am not good at English, so I am sorry I do not understand.

On the properties there is a tab on the right called Conditional. If you create a condition and set something like Search for Tests:last item is not empty, hopefully Bubble will load all the items to satisfy the condition.

The action to take when the condition is true could be either:

  • Set visible to true, or
  • Set the HTML to the script as above (and make the default HTML empty)

Thank you for your careful explanation.

Does Search for Tests:last item is not empty mean that the HTML element is set to “Conditional”?
I tried doing so, but it did not change the situation.

I also tried to run the script from workflow instead of the HTML element, but in that case I was not able to get the number of items that were selected.
In the example above, I wanted to retrieve 200 items, but was only able to retrieve 80.

Thanks for all the suggestions.

Maybe time for a bug report to support?

Another thing to try is :make static after the list, so it doesn’t update. Hopefully all items would be retrieved then.