From your brief description, it seems you are trying to display different specs for different steps. The first script shows a method that uses arrays to make a tabbed display of tabs.
Names Default to Here(1);
steps= {"A", "B", "C", "D"};
step_aa = Associative Array(steps);
step_aa["A"] = {"1101", "1102", "1103", "1104"};
step_aa["B"] = {"2101", "2102", "2207", "2068", "270X"};
step_aa["C"] = {"37Z0", "3027", "3133"};
step_aa["D"] = {"4001", "4005", "4517"};
main={};
New Window( "Result", display = Tab Box() );
For( j = 1, j <= N Items( stepname ), j++,
display << Add(
steps[j], PanelBox("",
tb = Tab Box();
));
tb << Set OverFlow Enabled(0);
insert into(main,tb);
);
For( j = 1, j <= N Items( stepname ), j++,
for(k=1, k<=nitems(step_aa[steps[j]]), k++,
main[j] << Add (EvalInsert("Data Table(\!"Specname=^step_aa[steps[j]][k]^\!")"))
); // add for k
main[j] << set selected(1); //select the first tab
);
display << set selected(1);
However, I think a better option is to use a Tree with TreeNodes. Below is an example and the resulting display.
Names Default to Here(1);
steps= {"A", "B", "C", "D"};
step_aa = Associative Array(steps);
step_aa["A"] = {"1101", "1102", "1103", "1104"};
step_aa["B"] = {"2101", "2102", "2207", "2068", "270X"};
step_aa["C"] = {"37Z0", "3027", "3133"};
step_aa["D"] = {"4001", "4005", "4517"};
roots = {};
For( j = 1, j <= N Items( steps ), j++,
root = TreeNode(stepname[j]);
insert into(roots, root);
);
For( j = 1, j <= N Items( steps ), j++,
For(k =1, k<=nitems(step_aa[steps[j]]), k++,
c = Tree Node( step_aa[steps[j]][k] );
roots[j] << Append(c);
);
);
New Window( "TreeBox Tests",
HListBox(
tree = Tree Box( roots, Size( 300, 200 ) ),
tb = TextBox()
)
);
tree << Set Node Select Script(
Function( {thistree, thisnode},
If( !Is Empty( thisnode ),
txt = thisnode << get label;
tb << set text ( EvalInsert("Data Table(\!"Specname=^txt^\!")") )
)
)
);