The new block instruction is used to group pages and questions.
It can also group other blocks (the so called nested blocks),
thus creating a tree-like hierarchy of blocks > pages > questions.
Note that you cannot put blocks inside pages and/or questions (nor pages inside questions).
Using blocks to group elements doesn't introduce any new functionality yet
(though blocks may be used in 3rd party software when exporting documentation to other programs,
for instance when creating question modules when exporting data to YAC Data Analyzer).
However, you can specify that the order of elements in a block should be randomized.
This is done using the rand instruction (just as you would you is in questions).
def block
rand = 1;
. . .
end;
Thus, the above instruction turns randomization on in the defined block.
Note, however, that only elements defined directly in this block will be randomized.
Elements that are defined inside other elements will not be affected by this instruction.
Consider the following example:
def block
rand = 1;
def block
. . .
end;
def block
. . .
end;
end;
The two nested blocks will be shown in random order.
But elements of the nested blocks (assuming there's no rand instruction inside those blocks)
will be displayed in the order of the respective definitions.
Consider yet another example:
def block
rand = 1;
def block
rand = 1;
. . .
end;
def block
. . .
end;
end;
First, the two nested blocks will be shown in random order.
Next, questions inside the first block will be shown in random order.
However, questions inside the second block, regardless whether this block is shown first or second,
will be displayed in the order of definitions.
Finally:
def block
rand = 1;
def block
rand = 1;
. . .
end;
def block
rand = 1;
. . .
end;
end;
Again, the nested blocks will be displayed in random order.
Elements inside both blocks will also be randomized.
However, all questions from block 1 will always go before block 2 or after block 2.
Questions from these two blocks will never be intermingled.
The above solution will work, for instance, when testing several versions of a product / package / etc.,
and you want to test these products in random order.
But you don't want to mix questions about one product with questions about another product.
Thus, questions for each product should be grouped inside respective blocks,
and then these blocks may be nested inside another block that has randomization turned on.
This was the main idea behind the introduction of blocks in YAC Interview Kit.
Note, though, that the randomization function inside pages plays a similar role:
def page
rand = 1;
. . .
end;
Though this concerns questions placed on a single page only.
Top
|