大家好,
我想為應用程式/儀表板建立程式碼。我的程式碼的第一部分導入一些表,進行一些過濾和格式化,然後建立一些圖表和報告。
之後,我希望有通用程式碼來建立應用程式/儀表板來顯示我之前使用現有資料表(在過濾和格式化之後)製作的報告。在沒有提示選擇用於分析的資料表或已經嵌入但不正確的資料表的情況下,我無法透過腳本解決這個問題。基本上,資料表1 使用當前的資料表名稱,這很好,但所需的第二個資料表被嵌入,但本質上它預設為未格式化和未過濾的資料表,即使作為變量,格式化的資料會覆蓋到原始資料表上。
我還嘗試保存格式化的表,然後使用完整路徑(全域變數)來呼叫它們,但當我嘗試運行程式碼時,仍然提示我選擇要建立應用程式的表。
總的來說,我試圖使其盡可能通用並編寫腳本,因為每次運行時,使用的數據表都會有不同的數據(相同或幾乎相同的列,但數據不同)。
我對儀表板沒有太多的經驗,除了在儀表板建構器中建立儀表板並且沒有完全編寫腳本之外。
謝謝
您使用的是應用程式/儀表板產生器還是僅使用 JSL?
我更願意最終使用 JSL 來完成所有事情。但是,現在我正在使用 JSL 導入表並重新格式化它們,但要為應用程式建立一些程式碼,我正在使用應用程式/儀表板建構器
您能否提供腳本的 JSL 部分並標記/解釋您遇到問題的部分?您從哪裡獲取路徑?使用者在運行腳本之前是否打開了一個表(強制使用當前資料表())?另外,您是否嘗試過使用工作流程建構器執行此操作?
dt1 = Open( "XXXXX.csv" );
If( Not( Is Scriptable( dt1 ) ),
dt1 = Open( "XXXXX.csv" ),);
Wait( 2 );
dt2=Data Table( dt1 ) << Subset(
Rows(
Data Table( dt1 ) <<
Select Where (
:X == "1" & :"Y"n == "2" &
:Z == "3)), All Columns);
Wait( 2 );
dt3 = Open( "YYYY.csv" );
If( Not( Is Scriptable( dt3 ) ),
dt3 = Open( "YYYY.csv" ),);
dt2 << Set Name("MainDataTable");
dt3 << Set Name("SpecTable");<BR />::saveloc_dt2 = Concat Items( {new_folder, "\MainDataTable",".csv"}, "" );<BR />dt2 << Save(saveloc_dt2);<BR />::saveloc_dt3 = Concat Items( {new_folder, "\SpecTable",".csv"}, "" );<BR />dt3 << Save(saveloc_dt3);
Current Data Table( dt2 );
cc = Control Chart Builder(Show Control Panel(0),Show Capability(0),Size(700,450),Show Excluded Region( 0 ),
Variables( Y( :X ) ),
Local Data Filter(
Add Filter(
columns( :Z),
Display( :A, Find( Set Text( "" ) ) ))),
Chart( Position( 1 ), Limits( Shade Zones( 0 ) ) )););
Current Data Table( dt2 );
process_screening = Process Screening(
Process Variables(
:A, :B, :C,
Grouping( :Y ),Control Chart Type( "Indiv and MR" ),Within Sigma( 0 ),Overall Sigma( 0 ),Stability Index( 0 ),Show Tests( 0 ),Out of Spec Count( 1 ),Out of Spec Rate( 1 ),
Latest Out of Spec( 0 ),N Subgroups (0 ),Ppk( 1 ),Cp( 1 ),Cpk(1),Cpm(1),Spec Limits( 1 ),
Use Limits Table(
1,
Data Table( "SpecTable" ),
Process Variables( :Process ),
Grouping( :Z ),
LSL( :LSL ),
USL( :USL ),
Target( :Target ),
Go
),
Goal Plot( 0, Capability Lines( 1.33 ), Shade Levels( 0 ) ),
Process Performance Graph( 0 ));
JMP App(
Set Name( "Application" ),
Set Description(
"An empty workspace for creating custom applications with one or more windows and scripts"
),
Auto Launch( 1 ),
Snap To Grid( 1 ),
Show Grid( 1 ),
Show Properties( 1 ),
Show Sources( 1 ),
Group By Category( 1 ),
Dashboard Mode( 0 ),
Parameters,
Tables(
DataTable2 = GuiTable(
Set Path( saveloc_dt2 ),
Set Label( "MainDataTable" ),
Location( "Full Path" ),
Invisible( 0 )
),
DataTable3 = GuiTable(
Set Path( saveloc_dt3 ),
Set Label( "SpecTable" ),
Location( "Full Path" ),
Invisible( 1 ))),<BR />. . . . 我認為這樣我可以引用我剛剛在應用程式中格式化(並保存)的數據表,但我得到一個窗口,提示我選擇要使用的表。這是我希望避免的部分。
我想另一個選擇是只製作我想要的報告,並使用組合視窗功能將它們放入儀表板類型視窗中,然後嘗試獲得正確的間距等。
我對腳本的第一部分進行了一些清理,希望它能給您一些關於腳本編寫和編寫 JSL 的想法
Names Default To Here(1);
new_folder = "MYFOLDER";
// Checking for scriptable should be unnecessary
dt1 = Open("XXXXX.csv");
// Datatable(dt1) is unnecessary in 99% of cases
// Use << Get Rows Where instead of Select Where with Rows() in subset
// Use output table() to make debugging much easier
dt2 = dt1 << Subset(Rows(dt1 << Get Rows Where(:X == "1" & :"Y"n == "2" & :Z == "3")), Selected Columns(0), Output Table("MainDataTable"));
dt3 = Open("YYYY.csv");
dt3 << Set Name("SpecTable");
// simpler in this case
saveloc_dt2 = new_folder || "\MainDataTable.csv";
dt2 << Save(saveloc_dt2);
saveloc_dt3 = new_folder || "\SpecTable.csv";
dt3 << Save(saveloc_dt3);
// You can send messages directly to data table, do not use current data table() if possible
cc_expr = Expr(dt2 << Control Chart Builder(
Show Control Panel(0),
Show Capability(0),
Size(700, 450),
Show Excluded Region(0),
Variables(Y(:X)),
Local Data Filter(Add Filter(columns(:Z), Display(:A, Find(Set Text(""))))),
Chart(Position(1), Limits(Shade Zones(0)))
));
ps_expr = Expr(dt2 << Process Screening(
Process Variables(
:A,
:B,
:C,
Grouping(:Y),
Control Chart Type("Indiv and MR"),
Within Sigma(0),
Overall Sigma(0),
Stability Index(0),
Show Tests(0),
Out of Spec Count(1),
Out of Spec Rate(1),
Latest Out of Spec(0),
N Subgroups(0),
Ppk(1),
Cp(1),
Cpk(1),
Cpm(1),
Spec Limits(1),
Use Limits Table(1, Data Table("SpecTable"), Process Variables(:Process), Grouping(:Z), LSL(:LSL), USL(:USL), Target(:Target), Go),
Goal Plot(0, Capability Lines(1.33), Shade Levels(0)),
Process Performance Graph(0)
)
));
nw = New Window("My report",
V List Box(
cc = cc_expr,
ps = ps_expr
)
);
建立報表的一種選擇是使用 Expr() 包裝平台調用,然後在新視窗中調用這些表達式您也可以跳過表達式並僅使用平台調用建置視窗(或使用其他一些方法)
nw = New Window("My report",
V List Box(
cc = dt2 << Control Chart Builder(
Show Control Panel(0),
Show Capability(0),
Size(700, 450),
Show Excluded Region(0),
Variables(Y(:X)),
Local Data Filter(Add Filter(columns(:Z), Display(:A, Find(Set Text(""))))),
Chart(Position(1), Limits(Shade Zones(0)))
),
ps = dt2 << Process Screening(
Process Variables(
:A,
:B,
:C,
Grouping(:Y),
Control Chart Type("Indiv and MR"),
Within Sigma(0),
Overall Sigma(0),
Stability Index(0),
Show Tests(0),
Out of Spec Count(1),
Out of Spec Rate(1),
Latest Out of Spec(0),
N Subgroups(0),
Ppk(1),
Cp(1),
Cpk(1),
Cpm(1),
Spec Limits(1),
Use Limits Table(1, Data Table("SpecTable"), Process Variables(:Process), Grouping(:Z), LSL(:LSL), USL(:USL), Target(:Target), Go),
Goal Plot(0, Capability Lines(1.33), Shade Levels(0)),
Process Performance Graph(0)
)
)
)
);
我建議您查看JMP 幫助中的腳本指南。無需通讀所有內容,只需到處查看一下,看看其中包含什麼內容。