Group Command¶
This command Determine collection of commands, so you can manage them easily.
Note
The group
command inherit from CommandBase Class.
Important
The group
command an not be present as void command and must have child elements like command or html
.
1 2 3 | <basis core="group" >
[commands]
</basis>
|
Remarks¶
One important things about group
command is that each instance of this command create a scope
.
A scope
use for determine boundary of data source visibility.
Note
A Scope
is abstract boundary that help programmer to manage data source visibility.
For more information, visit Wiki/Scope.
For example suppose we have document with this command order structure:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <basis core="group" name="group-1" >
<basis core="dbsource" name="db-1">
[...]
</basis>
<basis core="group" name="group-2" >
<basis core="dbsource" name="db-2">
[...]
</basis>
</basis>
</basis>
|
In above example, we have two group
command.
Each command create a scope
.
Now we have a scope
with a inner scope
.
Each scope
, in her content collection have a DbSource command.
In scope created with inner group
(group-2), all command can access
to any data source loaded with db-2
and db-1
.
This happen because a data source added to the Context,
accessible for from contex
related scope
and all sub scope that is child of this :class:’scope’.
So in our example, db-2
only visible in group-2
scope, but db-1
visible in
both group-1
and group-2
.
The group
also can ues for implement If-then-(else)
statements of Control Flow in rendering process.
Note
For more information about control flow, visit Wiki/ControlFlow.
For example suppose you want execute some set of commands if value of output
key in query string is A
and if value is B
, other set of commands be executed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <basis core="group" name="group-if" if="'[##cms.query.output##]' = 'A'" >
[some commands]
</basis>
<basis core="group" name="group-else" if="'[##cms.query.output##]' = 'B'" >
[some else commands]
</basis>
|
In above example code, we use two group
with conjunction with if
attribute for implement If-then-else.
You can also set if
attribute for each command in group
but it’s massy and not elegant choice.
Tip
For more information about using if
attribute, See Simple Conditional Execution.
Order of Command Execution¶
In each group
command, process of executing child command run in specific order.
:edit:`Add`