Show a subset of records in various places on a page

I initially thought this would be easy but am now wondering the best way to achieve this.

I have a query which will return some records. I want to show those records in different places on the page depending on the value of one of the fields.

For example, one field is ‘paragraph_number’ and I want to show all the records matching a particular number on one place in the page. Further down I want to show all the records with a different paragraph number.

I wondered if the Data Iterator was the way to go, or possibly Data Detail, but I’m now not so sure.

Also, where would be the best place to action it? I want all the info to display right away and not processed when an event like a button click is run.

You can just create different repeats from your query and use the where formatter to filter the records based on a column value.

No, data iterator is used to iterate through the records one by one. Data detail is used to show details per record based on an id.

1 Like

I default to setting up these arrays on the server rather than at the client.

A where clause on the client is obviously fine in most situations, but formatters in general increase the activity level of the browser as they need to be handling updates. It took me a while to realize how impactful formatters can be on performance.

Of course, sometimes that is what is called for, so by pushing as much as possible to the server, I can use formatters when really needed.

My approach would be to use set value actions to setup your arrays based on your db query and then display with repeats without a where clause. This assuming they are display only and not requiring some other treatment.

Where is the ‘where’ formatter? I’ve created the repeat but can’t see how to do the filter. Sorry, haven’t used this particular feature before.

Your method is similar to how I initially thought I’d tackle it but I’m not sure how to actually implement that on the page.

1 Like

It’s similar to what Teodor is showing, just using a set value server action.

If this is all new to you though, take the path of least resistance!

1 Like

There are still gems in Wappler I had no idea were there. :slight_smile: