What is the group step in a server action?

Hi,
I could not find info about this step.

Does anyone know when and how to use it? Same for the “parallel” step to its left.

I imagine that when these steps were added, they were mentioned in the announcement, but looking through previous announcements is not (should not be) the way to find out how to use a feature. Searching for a word as common as “Group” leads to a lot of irrelevant hits. This is very frustrating, because now I have to bother this forum for help, for something that ideally should not require that at all.

As an aside: We complain a lot about Bubble, but they licked this issue: everything in Bubble had (at least a few years ago, when I used it) an “info” icon that one can click to go to the manual page where the gizmo is described.

Remember, some of the Wappler users (I’m one of them) don’t know as much about programming as others, but still believe that Wappler is a great tool to get things done. Users like me, who are not programmers, still need to know how to use certain things. I know this dead horse has been kicked quite a lot in this forum, but we cannot do it without some good documentation.

Thank you in advance,

Alex

6 Likes

Missed this post.

The Group allows you to create an object. I sometimes use it for exmaple as such:


Which will give you this JSON object:

{
  "buyer_info": {
    "recip_name": "Example name",
    "recip_contact_name": "Example contact name",
    "recip_email": "email@gmail.com",
    "recip_address_line_1": "aergae1",
    "recip_address_line_2": "2232AA Test",
    "recip_address_line_3": "NL"
  }
}

And another way that I use it, is to organise my server actions, visually:

THe parallel action is explained somewhere, I haven’t used it yet. I think it allows you to run things async. So your application does NOT wait for the thing to finish that you put in the ‘parallel’ step. That way you can execute things in parallel.
However, I need confirmation on this.

5 Likes

Thank you so much for the explanation!

@Romy: it may be a good idea to include karh’s explanation in your upcoming document.

3 Likes

Yes we definitely need more explanations about all the components and actions. I am not a developer myself and i can not explain these, but i know they are on their way! :wink:

5 Likes

Thanks for posting this, that’s a great help. My code is never normally the neatest, this group function will enable me to have much cleaner and easier-to-understand Server Actions.

2 Likes

Glad it helps! I try to organise it as otherwise I spend so much time just figuring out what is going on as time goes by

1 Like

Some of our older sites have legacy code (in Classic ASP) written by me from late 1990s, I still need to revisit from time to time and am constantly horrified by the lack of commenting and sloppy coding I did way back then. Wappler is a refreshing change, it makes me look much more professional.!

1 Like

The Group action just groups actions output under a common key but still execute them sequentially, while the Parallel action executes all action steps under it simultaneously and when all are done then it proceeds to the next step. This way you can run multiple actions like remote API calls and Database Queries and wait till all their data is gathered and then process it.
This is only for NodeJS.

So this just a logical grouping on server action level? Or the use case is to make a key-value pair object to use in below steps?

Not sure if intended, but can definitely be used to make a key-value pair object

The K-V pair is it’s biggest benefit imho

Hi,
Would a group action be recommended to build a complex array of JSON objects? (By complex, I mean an array of objects that where each object has some nested objects.)

If so, can someone post an example of how to build such array?

Many thanks!!

Alex

1 Like

To create an array use the Repeat step, it returns an array. To create an object use the Group step and Set Value inside it. For creating a nested object use another Group step inside the primary Group step

4 Likes

Belated thanks.

Parallel in graf view show in vertical branch, from explanations @Teodor It became clear that the calculations are performed in parallel, maybe it makes sense to display the calculation steps in parallel branches?

1 Like

@apple Thank you, this was extremely useful, I was looking through various documents and this was the light to the solution!