Col list box() 不尊重數據表引用使用 JMP 14.1:
我希望人們選擇兩個數據表,然後在兩個 col 列錶框中顯示這些數據表中的列。 但是,當我在框中設置列時,JMP 只會設置活動數據表中的列,而不會考慮數據表參數。 有什麼建議麼?
這是錯誤行為的簡單示例:
dt = New Table( "Table 1",
Add Rows( 0 ),
Compress File When Saved( 1 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
dtNew = New Table( "Table 2",
Add Rows( 0 ),
Compress File When Saved( 1 ),
New Column( "Column 4",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 5",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 6",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
new window("Column renamer",
h list box(
Panel box("Source table",
SourceBox = Col List Box(dt,All)
),
Panel box("Destination table",
DestBox = Col List Box(dtnew,All),
),
)
);這個結果是:

預期結果是在左側列表中顯示列 1、2、3,因為它們是第一個表中的名稱。 相反,它顯示第二個表(最後創建的,因此是活動表)兩次。
回复:Col list box() 不尊重數據表引用明白了! 如果您願意,可以使用“ColListBox()”做類似的事情:
Names default to here(1);
ListOfOpenTables = sort list(Get Data Table List());
updateCLB =
Expr(
Try(clb << delete);
thisTable = (tlb << getSelected)[1];
CMD = Expr(nw << Append(clb = ColListBox(DataTable(tableTBD), All, maxSelected(1), clbAction)));
SubstituteInto(CMD, Expr(tableTBD), Eval(thisTable));
CMD;
);
clbAction =
Expr(
Speak("Column "||(clb << getSelected)[1]||" was selected.");
);
nw = NewWindow("Test", tlb = ListBox(ListOfOpenTables, maxSelected(1), updateCLB));
回复:Col list box() 不尊重數據表引用是的,通過使用標準列錶框我可以使用它,但它看起來不像 JMP 通常使用的列選擇對話框。 而且它不顯示數據表中的列分組。 因此我想用 col 列錶框來實現它:)回复:Col list box() 不尊重數據表引用抱歉,保羅,我沒有時間了解您正在嘗試做的事情的細微差別。
但這裡有一個舊的代碼片段可能會讓你更接近(不使用'ColListBox()'):
Names default to here(1);
ListOfOpenTables = sort list(Get Data Table List());
updateCLB =
Expr(
thisTable = (tlb << getSelected)[1];
CMD = Expr(cols = DataTable(tableTBD) << getColumnNames("String"));
SubstituteInto(CMD, Expr(tableTBD), Eval(thisTable));
CMD;
clb << setItems(cols);
);
clbAction =
Expr(
Speak("Column "||(clb << getSelected)[1]||" was selected.");
);
nw = NewWindow("Test",
tlb = ListBox(ListOfOpenTables, maxSelected(1), updateCLB),
clb = ListBox({"Pick a table above"}, maxSelected(1), clbAction)
);回复:Col list box() 不尊重數據表引用嗨伊恩,感謝您的幫助,但確實沒有解決我的問題。 這是我真正想做的更大的代碼片段。 因此,您從打開的表中選擇兩個不同的表,當您選擇一個不同的表時,它下面的列列表將填充所選表中的列:
Names default to here(1);
ListOfOpenTables = sort list(Get Data Table List());
ColumnWidth = 300;
new window("Column renamer",
h list box(
Panel box("Source table",
v list box(
FirstDT = List box(ListOfOpenTables, maxSelected(1), width(ColumnWidth),
dt = Data Table((FirstDT << get selected())[1]);
SourceBox << Set items(Data Table((FirstDT << get selected())[1]) << Get Column Names("String"));
),
SourceBox = Col List Box(,nlines(40), width(ColumnWidth),
OldCounter << set text(char(n items(SourceBox << get selected())) || " Columns selected");
dt << Select columns(SourceBox << get selected());
),
OldCounter = Text Box("")
)
),
Panel box("Destination table",
v list box(
SecondDT = List box(ListOfOpenTables, maxSelected(1), width(ColumnWidth),
dtnew = Data Table((SecondDT << get selected())[1]);
DestBox << Set items(Data Table((SecondDT << get selected())[1]) << Get Column Names("String"));
),
DestBox = Col List Box(,nlines(40), width(ColumnWidth),
NewCounter << set text(char(n items(DestBox << get selected())) || " Columns selected");
dtnew << Select columns(DestBox << get selected())
),
NewCounter = Text Box("")
)
),
Panel box("Actions",
v list box(
button box("Change column names",DoTheWork),
button box("Undo",Undo)
)
)
)
);回复:Col list box() 不尊重數據表引用沒有回答你真正的問題,但這有效(Mac 上的 JMP 14.2):
dt = New Table( "Table 1",
Add Rows( 0 ),
Compress File When Saved( 1 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
dtNew = New Table( "Table 2",
Add Rows( 0 ),
Compress File When Saved( 1 ),
New Column( "Column 4",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 5",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "Column 6",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
new window("Column renamer",
h list box(
Panel box("Source table",
SourceBox = Col List Box(DataTable( "Table 1"),All)
),
Panel box("Destination table",
DestBox = Col List Box(DataTable( "Table 2"),All),
),
)
);