大家好,
我目前正在使用數據過濾器開發一個數據提取介面。我可以建立這個介面,問題出在 JMP19 中過濾器的列佈局上。
在 JMP17 中,篩選器的列位於 LineUpBox() 函數內。 LineUpBox 函數有兩個實用函數:NCol 和 Spacing,它們允許我將列排列在多行上,並在列之間添加空格。
Tree Structure of the Data Filter in JMP17Tree Structure of the Data Filter in JMP17JMP17 中資料過濾器的樹狀結構
然而,在 JMP19 中,資料篩選器的樹狀結構發生了變化:LineUpBox() 被向上移動,而列的父級是一個沒有 NCol() 和 Spacing() 函數的 ListBox()。我可以使用 << Set Horizontal(1) 函數,但只能設定一行,顯示效果也不理想。
(或許這項更改是在 JMP18 中發生的,我沒有在這個版本中嘗試過)。
Tree Structure in JMP19Tree Structure in JMP19JMP19中的樹狀結構
您知道如何在 JMP19 和 JMP17 中排列篩選器的欄位嗎?
我嘗試在內部創建一個新的 LineUpBox() 對象,並將邊框框作為子對象移動,但這樣會導致篩選功能丟失,而且無法輕鬆刪除舊的邊框框。我知道可以透過建立一個新的 Window() 對象,並在其中為篩選條件的每一列建立一個 ListBox() 物件來實現類似的效果,但我更喜歡使用資料篩選器,因為它具有條件屬性,而且可以輕鬆地將其應用於不同的表格和不同的列。
下面是一個兩列的範例(但實際上我可以添加更多列)。它在 JMP17 中可以正常工作(兩列水平顯示),但在 JMP19 中則不行。
Window from JMP17Window from JMP17JMP17視窗
f_extraction = Function({dt, cols_list, nbColsLine = 2, spacingLine = 30},
my_window = New Window("Extraction with filter",
Border Box(
Left(20), Top(10), Right(20), Bottom(10),
V List Box(
Panel Box("",
Eval(
Eval Expr(
// Creation of the Data Filter, with two columns as an example
df = dt << Data Filter(
Show Counts(0),
Conditional(1),
Show Histograms and Bars(0),
Add Filter(
Columns(Expr(cols_list)),
Display(cols_list, "List Display"),
)
)
)
);
// Here, the columns of the filter are reorderer in two columns with a space of 30 between them
// This is where I have the problem in JMP19 compared to JMP17 because the Tree Structure is different
(df << report)[Lineup Box( 2 )] << N Col( nbColsLine );
(df << report)[Lineup Box( 2 )] << Spacing( spacingLine );
For( i = 1, i <= N Items( cols_list ), i++,
(df << report)[ListBoxBox( i )] << Set Size( 180, 220 )
);
// We delete some buttons and check boxes that we don't need
(df << report)[Button Box( 4 )] << Delete;
(df << report)[Button Box( 3 )] << Delete;
(df << report)[Button Box( 2 )] << Delete;
(df << report)[CheckBoxBox( 4 )] << Delete;
(df << report)[CheckBoxBox( 3 )] << Delete;
(df << report)[CheckBoxBox( 2 )] << Delete;
(df << report)[CheckBoxBox( 1 )] << Delete;
(df << report)[Outline Box( 1 )] << Set Title( "Data Table Filters" );
),
Spacer Box(Size(0, 20)),
Button Box("OK",
// Script where I retrieve the user selection
)
)
)
)
);
// Example
Try(Close(Data Table("Big Class"), No Save));
dt = Open( "$SAMPLE_DATA/Big Class.jmp", Invisible);
f_extraction(dt, {"sex", "name"})
感謝您的幫助 !
可惜的是,依賴這種類型的結構很容易崩潰, https://www.hyrumslaw.com/ 。
我認為僅僅修改顯示框是無法輕鬆解決問題的。資料篩選器結構的變更也導致我工作中管理的一些插件的介面出現問題,但原因不同,而且(希望…)處理起來比嘗試將篩選器組織成網格要容易得多。
左邊是 JMP18,右邊是 JMP19。

是的,我知道這不是應對這些可能變化的結構的最佳方法!
我想暫時就先這樣吧,謝謝分享你的經驗 