Difference between Array and Multiple in server action

Hi,
For a server action API, I know I can declare, in its Input section, variables that I will pass as parameters to it, so those variables can be referenced in the server action steps.

I’m trying to understand the following:

  1. What are the differences between a parameter declared as a “Variable” with the “Multiple” box ticked and another declared as an “Array” ?
  2. What would be the syntax in the server action to address items in each of those aggregate parameters?
  3. What would be the syntax in the client side to assemble those parameters so they are passed to the server action by a server connect?
  4. Again in the server side, when creating an Input parameter, irrespective of the type selected (Variable, Array, and Object), I can configure something called “Linked Field”. What is it for and how is that used?

Any info on the above (or a pointer to Wappler documents where I can read about all this) would be appreciated. I searched for this info but could not find much.

Many thanks in advance,

Alex

I haven’t used the array option, as I’ve always just ticked multiple, so can’t really comment on that (but I suspect it will behave similarly).

Anything that comes in as an array can be used as the source for a repeat on the server side. You can then get all all the individual items, one by one. Additionally, arrays can be referenced by their index number, so arrayname[0] gets the first item, arrayname[1] gets the 2nd and so on.

On the client side, the name property of an input can have []added to indicate it will be sending an array. For example if you have the following:

<input id="text1" name="invoice_id[]" type="text" class="form-control">
<input id="text1" name="invoice_id[]" type="text" class="form-control">

It will send an array of values to the parameter named invoice_id.

The linked field is used for validation – If the input fails any applied server validation, the error message will be displayed alongside the input with the name referenced in the linked field.

Thank you Ken for the prompt answer.
I wonder then why we have an option for “Array” if both variables and objects can be declared as a “multiple”…
Maybe someone in the Wappler team can clarify that?

Alex

Gentle nudge to the Wappler team on my questions above.

Perhaps @Teodor can put a short tutorial together for all this?
And maybe also explain what would be a use case for defining a variable as an array and also ticking the Multiple checkbox?

Many thanks!!!