How can I merge two or three database queries or Repeats? (same columns)

Hi,

How can I merge two or three database queries or Repeats? They all have the same columns, I made sure of that.

Thank you.

Repeat {some_datasource}
   - Set Value id: 123
   - Set Value name: John
Database Query users:
   - id
   - name

This is from ChatGPT. It's all Greek to me but maybe you can make sense of it.

Great β€” Wappler makes this very straightforward because both Repeat Regions and Database Queries can be turned into arrays, and then you can merge them inside a Server Action.

There are two main ways to merge multiple queries/arrays in Wappler.


:white_check_mark: Method 1: Use the β€œArray Merge” Action (Easiest)

In a Server Action:

  1. Add your Repeat step
  • Inside the repeat, output { id: 123, name: 'John' } items.
  1. Add your Database Query (users table).
  2. Add a "Array Merge" step:
  • Input 1: the Repeat output array
  • Input 2: the Database Query results

This produces a single merged array.

:check_mark: No formatting needed
:check_mark: Keeps column structure (id, name, etc.)

Example (visual structure)

server action
 β”œβ”€ Repeat (items you manually build)
 β”‚   └─ Set Value: id, name
 β”œβ”€ Database Query: users
 └─ Array Merge
       input1: repeat
       input2: users

The explanation looks convincing, but there's no "Array Merge" step :sweat_smile:

Thanks for chiming in though

1 Like

What about using server connect array?
https://community.wappler.io/t/working-with-server-connect-array-lists/47668

Repeat -> add in array

1 Like

There is an "Add all to array" step that you can use.
So query > add all to array, then another query > add all to array
the resulting array will contain both query results.