如何建立使用日期篩選器產生帕累托圖的腳本大家好,
我希望你一切都好。我在建立腳本以從要按日期(date1 和 date2)過濾的表中產生帕累托圖時遇到問題。
作為第一步,我使用以下方式調用我的表:
dt2 = Open( "/D:/Project JMP/Tables/Table NOK PY.jmp", invisible );
下一個 :
dt2_top5 = dt2 << Summary(
Group( :Date, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :CodeError),
Freq( "Aucun(e)" ),
Weight( "Aucun(e)" ),
output table name( "Table2 Top 5" ),
invisible
);
// Subset of data for Pareto plot filtered by Date
dt_pareto_subset = dt2_top5 << Select Where( Num( Char( :Date ) ) >= Num( date1 ) & Num( Char( :Date ) ) < Num( date2 ) );
dt_pareto_subset = dt2_top5 << Subset(
Selected Rows(1),
Columns(:CodeError),
output table name("Pareto Subset"),
invisible
);我確實在視窗中創建了帕累托圖:
Border Box(Left(25), Top(50), Bottom(200),
V List Box(
// Add the Pareto plot here
paretoPlot = dt_pareto_subset << Pareto Plot(
Y( :CodeError ),
Freq( "Freq" ),
Show Percents( 1 ),
Show Cumulative Line( 1 )
),
)
)
但在我啟動腳本後,我確實收到了這個錯誤:

存取或評估「Send」時需要腳本對象,dt_pareto_subset << /*###*/
帕累托圖(
Y(:代碼錯誤),
頻率(“頻率”),
顯示百分比(1),
顯示累計線(1)
)/*###*/
我有一個產生帕累托圖的小程式碼片段。目前,我每次都必須手動選擇資料表,並且無法套用日期篩選器:
Pareto Plot(
Cause( :CodeError ),
SendToReport(
Dispatch( {"Plots"}, "Pareto Report", FrameBox, {Frame Size( 1555, 725 )} )
)
);
感謝大家的幫助,
此致,
亞斯
視窗回覆:如何建立一個腳本來產生帶有日期過濾器的帕累托圖您在 dt_pareto_subset 中有您期望的子集嗎?
回覆:如何建立一個腳本來產生帶有日期過濾器的帕累托圖是的,我希望 dt_pareto_subset 僅包含 dt2_top5 中的行,其中 :Date 列中的值介於 date1 和 date2 之間
回覆:如何建立一個腳本來產生帶有日期過濾器的帕累托圖錯誤訊息表示變數 dt_pareto_subset 沒有可編寫腳本的物件(在本例中為資料表)。造成這種情況的原因可能有很多,並且在沒有看到您的資料或完整腳本的情況下完全是猜測。
回覆:如何建立一個腳本來產生帶有日期過濾器的帕累托圖
Names Default To Here( 1 );
TOP5 = New Namespace(
"TOP5"
);
TOP5:get_dates = Function({},
////
);
TOP5:calculate_nok_percentages = Function({dt},
/////
);
// Define the Do function
TOP5:Do = Function ({nb_date1, nb_date2},
//Ouverture de la table de données
dt = Open( "/D:/Project JMP/Tables/TableData PY.jmp", invisible );
dt2 = Open( "/D:/Project JMP/Tables/Table NOK PY.jmp", invisible );
{percent_nok_ict, percent_nok_fct} = TOP5:calculate_nok_percentages(dt);
current_month = Format(Today(), "Format Pattern", "<MONTH>", << Use Locale(0));
date1 = Date Increment(Today(), "day", nb_date1, "start");
date2 = Date Increment(Today(), "day", nb_date2, "start");
dt_top5 = dt << Summary(
Group( :Date, :Nom de fichier, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :Result, :CodeError),
Freq( "Aucun(e)" ),
Weight( "Aucun(e)" ),
output table name( "Table Top 5" ),
invisible
);
dt2_top5 = dt2 << Summary(
Group( :Date, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :CodeError),
Freq( "Aucun(e)" ),
Weight( "Aucun(e)" ),
output table name( "Table2 Top 5" ),
invisible
);
// Subset of data for Pareto plot filtered by Date
dt_pareto_subset = dt2_top5 << Select Where( Num( Char( :Date ) ) >= Num( date1 ) & Num( Char( :Date ) ) < Num( date2 ) );
dt_pareto_subset = dt2_top5 << Subset(
Selected Rows(1),
Columns(:CodeError),
output table name("Pareto Subset"),
invisible
);
/*
//
//
//
Here i have the logic of production repport.
it's fine it works
//
//
//
*/
//Création de la fenetre du top 5
window = new Window ("TOP5",
V List Box(
pb = Picture Box( Open( "D:\Project JMP\Images\logo.png", png ) ),
Border Box( Top(50),
V List Box(
tb1 = Text Box("Production results report of "||Format( date2, "yyyy-mm-dd" )),
tb1 << Set Base Font( "Title" ),
tb1 << Set Font Scale (3),
tb1 << Justify Text("Center"),
tb1 << Set Width(2770),
tb1 << Background Color(RGB Color(225, 225, 225)),
tb2 = Text Box ("SVI, PY"),
tb2 << Justify Text("Center") << Set Font Size(25),
tb2 << Set Width(2770),
tb2 << Background Color(RGB Color(240, 240, 240)),
)
),
V List Box (
Border Box (Top (100), Bottom(100), Left (25),
H List Box(
// TOP 5 ICT
V List Box(
tb3 = Text Box( "Top 5 NOK results for ICT"),
tb3 << Set Base Font( "Title" ),
tb3 << Set Font Scale (2),
H List Box(
// column bay
// column product ref
// column test number
//column %nok
// column product name
)
),
V List Box(
//nok percent for this month
),
)
),
Border Box(Left(25), Top(50), Bottom(200),
//TOP 5 FCT
V List Box(
tb4 = Text Box( "Top 5 NOK results for FCT"),
tb4 << Set Base Font( "Title" ),
tb4 << Set Font Scale (2),
H List Box(
// column bay
// column product ref
// column test number
//column %nok
// column product name
)
)
V List Box(
//nok percent for this month
),
)
),
Border Box(Left(25), Top(50), Bottom(200),
V List Box(
// Add the Pareto plot here
paretoPlot = dt_pareto_subset << Pareto Plot(
Y( :CodeError ),
Freq( "Freq" ),
Show Percents( 1 ),
Show Cumulative Line( 1 )
),
)
)
)
)
);
window << Maximize Window (1);
//Enregistrement du fichier image .png et du fichier texte .txt
window << Save Picture ("D:\Project JMP\Rapports de Production Quotidiens\Rapport du "||Format( date2, "yyyy-mm-dd" )||".png", "png");
window << Save Text ("D:\Project JMP\Rapports de Production Quotidiens\Rapport du "||Format( date2, "yyyy-mm-dd" )||".txt");
);</MONTH>
回覆:如何建立一個腳本來產生一個帶有日期過濾器的帕累托圖如果您在建立子集後建立繪圖,它是否會如預期般運作?所以不要把它放在新視窗內
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Time Series/Steel Shipments.jmp");
dt << New Column("Errors", Character, Nominal, Formula(
Match(Floor(:Steel Shipments / 1000),
4, "1000",
5, "2000",
6, "3000",
7, "4000",
8, "5000"
)
));
rows_of_interest = dt << Get Rows Where(02Feb1985<= :Date <= 09Jan1990);
dt_subset = dt << Subset(Rows(rows_of_interest), Selected Columns(0), Output Table("Subset"));
paretoplot = dt_subset << Pareto Plot(Cause(:Errors));回覆:如何建立一個腳本來產生一個帶有日期過濾器的帕累托圖你好,
我嘗試了你的腳本中的方法,它給了我帕累托圖,但沒有資料過濾器。例如,今天的帕累托必須是 2024-07-29 <= :Date < 2024-07-30。
所以我使用了這個函數:
// Function to get today's and yesterday's date
GetTodayAndYesterday = Function({},
today = Today();
yesterday = Date Increment(today, "day", -1, "start");
evallist({Format(yesterday, "yyyy-mm-dd"), Format(today, "yyyy-mm-dd")});
); dt = Open( "/D:/Project JMP/Tables/DB.jmp", invisible );
{yesterday, today} = GetTodayAndYesterday();
dt_top5 = dt << Summary(
Group( :Date, :Ref Produit, :Baie, :ICT_FCT, :Result, :CodeError),
Freq( "Aucun(e)" ),
Weight( "Aucun(e)" ),
output table name( "Table Top 5" ),
invisible
); // Create a subset of data for the Pareto Plot filtered by the date range
rows_of_interest = dt_top5 << Get Rows Where( Num( Char( :Date ) ) >= Num( yesterday ) & Num( Char( :Date ) ) <= Num( today ) );
dt_pareto_subset = dt_top5 << Subset(Rows(rows_of_interest), Selected Columns(0), Output Table("Pareto Subset"), invisible);
// Generate the Pareto Plot
paretoplot = dt_pareto_subset << Pareto Plot(Cause(:CodeError)); 我附上了我的資料庫樣本以供參考。
回覆:如何建立一個腳本來產生一個帶有日期過濾器的帕累托圖您想在帕累托圖中新增資料過濾器還是只想過濾資料?看起來您只想從資料建立子集,而沒有篩選器。
回覆:如何建立一個腳本來產生帶有日期過濾器的帕累托圖我需要使用子集使用日期過濾數據,為昨天的生產結果建立帕累托圖,因為我每天早上都會產生每日生產結果報告
回覆:如何建立一個腳本來產生一個帶有日期過濾器的帕累托圖應該不需要 num 和 char 到 num 的轉換。
也許是這樣的?
Names Default To Here(1);
dt = Open("$DOWNLOADS/DB.jmp");
yday = Date Increment(Today(), "day", -1, "start");
tday = Date Increment(Today(), "day", 0, "start");
dt_top5 = dt << Summary(
Group(:Date, :Ref Produit, :Baie, :ICT_FCT, :Result, :CodeError),
Freq("Aucun(e)"),
Weight("Aucun(e)"),
output table name("Table Top 5")
);
rows_of_interest = dt_top5 << Get Rows Where(yday <= :Date <= tday);
show(rows_of_interest);
dt_pareto_subset = dt_top5 << Subset(
Rows(rows_of_interest),
Selected Columns(0),
Output Table("Pareto Subset")
);
pp = dt_pareto_subset << Pareto Plot(Cause(:CodeError), Freq(:N Rows));

您也可以從初始表建立 paretoplot (過濾可能需要一些工作)

dt << Pareto Plot(
Cause(:CodeError),
Local Data Filter(
Add Filter(
columns(:Date),
Where(:Date == 3805056000),
Display(:Date, N Items(4))
)
)
);