DMDX Help.


Branch Backwards to Most Recent Keyword

<BB2MR [N]>


   
    MDSP bit 10000000 modifier, backwards branches go to the most recent occurrence of an item number instead of the first.

    Without BB2MR branching backwards in DMDX is rather crude, you can only branch backwards to the first occurrence in the itemfile (as opposed to the most recent occurrence) of item number
N because originally DMTG could not parse an item file backwards. The BB2MR option that overrides this.  When branching forwards if DMDX doesn't find an item number after a branch keyword item it will branch to the first occurrence of that item number in the item file unless BB2MR is on in which case it will branch to the most recent occurrence of the item number.  When a negative item number is used as a branch destination (and almost all times BB2MR is useful you'll be using a negative item destination) it will also branch backwards to the most recent occurrence of that item.  This is handy for repeating an item conditionally without having to code each item number in dozens of little branch items.  For instance we have a paradigm where the subject is allowed to check the time for instance as well as respond to the item.  After checking the time the item should be presented again.  This can either be done by putting the item number into the branches or by sticking a stub item before the RT gathering item and branching back to it so every RT gathering group of items can have the same structure.  Here a, b and c are responses and F7 and F8 display auxiliary information and F10 displays the time (with a bit of futzing around to get a leading zero on the seconds when needed):

<s 8> <g 8> <zil> <zor> <cr> <bb2mr>

~1;
+101 "First Question" * <mwb +a,9 +b,9 +c,9 +F7,7, +F8,8, +F10,4 binr,9> ;
~4 <set c1=millisectime/1000> <set c2=c1/60> <set c3=c1%60> <bi 6, c3 .lt. 10>;
5 <px .48> "" <apc 2>, ":" <apc 3> / <bu -1>;
6 <px .48> "" <apc 2>, ":0" <apc 3> / <bu -1>;
7 "F7 info" <bu -1>;
8 "F8 info" <bu -1>;
~9;
 
~1;
+102 "Second Question" * <mwb +a,9 +b,9 +c,9 +F7,7, +F8,8, +F10,4 binr,9> ;
~4 <set c1=millisectime/1000> <set c2=c1/60> <set c3=c1%60> <bi 6, c3 .lt. 10>;
5 <px .48> "" <apc 2>, ":" <apc 3> / <bu -1>;
6 <px .48> "" <apc 2>, ":0" <apc 3> / <bu -1>;
7 "F7 info" <bu -1>;
8 "F8 info" <bu -1>;
~9;

~1;
+103 "Third Question" * <mwb +a,9 +b,9 +c,9 +F7,7, +F8,8, +F10,4 binr,9> ;
~4 <set c1=millisectime/1000> <set c2=c1/60> <set c3=c1%60> <bi 6, c3 .lt. 10>;
5 <px .48> "" <apc 2>, ":" <apc 3> / <bu -1>;
6 <px .48> "" <apc 2>, ":0" <apc 3> / <bu -1>;
7 "F7 info" <bu -1>;
8 "F8 info" <bu -1>;
~9;


    Note that without the -1 (negative one as opposed to one) destination it wouldn't work as it would go on to the next item and without BB2MR all the -1s would have to be the individual item number for that group, 101, 102 or 103 in our example.  And because we've now got uniform branches we could replace most of that text with macros:


<s 8> <g 8> <zil> <zor> <cr> <bb2mr>
$~999 mu+* <mwb +a,9 +b,9 +c,9 +F7,7, +F8,8, +F10,4 binr,9>+
      mv+<set c1=millisectime/1000> <set c2=c1/60> <set c3=c1%60> <bi 6, c3 .lt. 10>+
      mw+<px .48> "" <apc 2>, ":" <apc 3> / <bu -1>+
      mx+<px .48> "" <apc 2>, ":0" <apc 3> / <bu -1>+
      mx+"F7 info" <bu -1>+
      mz+"F8 info" <bu -1>+;$

~1;
+101 "First Question" ~u ; ~4 ~v; 5 ~w; 6 ~x; 7 ~y; 8 ~z; ~9;
 
~1;
+102 "Second Question" ~u ; ~4 ~v; 5 ~w; 6 ~x; 7 ~y; 8 ~z; ~9;

~1;
+103 "Third Question" ~u ; ~4 ~v; 5 ~w; 6 ~x; 7 ~y; 8 ~z; ~9;

 

    There's another example of <bb2mr>'s use in the continue clock on examples.

 


DMDX Index.