Global Name Variable

What is a Global Variable and how is it used?

I’ve read the documentation, but I’m still not completely clear on its purpose and how it should be used.

Is it intended to pass data between different Server Connect actions, or is it meant for something else?

Any examples or explanations would be greatly appreciated.

Regards,

Have a look at Set value - Name and Global Name values discussion - Wappler General - Wappler Community

One example is a parent server connect API with a variable var1. If you call a child library action as part of that API and inside it also reference a variable named var1, then:

If global is left blank, the child action can do whatever it wants with var1 and the parent’s var1 will remain unaffected.

if global is set and named var1, then that child will automatically update not only its var1, but also the waiting parent’s as the child does its processing.

In a good use case, this equals highly reusable, elegant modularized code. Bad case: it leads to subtle bugs that can be a headache to trace.

1 Like

Read but dont get the difference… :frowning:

Use global name if you want to access the variable outside its current scope.