使用日曆框選擇日期範圍此 JSL 函數顯示一個包含兩個日曆方塊的模式對話方塊。 這些框與 JSL 鏈接,因此在左側框中選擇最短日期會使右側框中的不可用日期變灰,其他方向也類似。
Linked calendar boxesLinked calendar boxesLinked calendar boxesLinked calendar boxes連結的日曆框
JSL 被編寫為一個函數,您可以透過對日期範圍(顯示在標題列中)的可選限制來呼叫。函數呼叫傳回一個列表:
{2019 年 8 月 21 日、2019 年 8 月 26 日}
promptDateRange = Function( {minAllowed = 1jan1001, maxAllowed = 31dec2999},
{roundMidnight, result, startDate, endDate}, // local variables
roundMidnight = Function( {datetime}, // return the date, without the time...which is midnight at the start of a day
As Date( Date MDY( Month( datetime ), Day( datetime ), Year( datetime ) ) )
);
minAllowed = roundMidnight( minAllowed );
maxAllowed = roundMidnight( maxAllowed );
result = New Window( "Select date range between " || Char( minAllowed ) || " and " || Char( maxAllowed ),
modal, // modal: the window must be closed before JMP can continue
// do the validation in OnValidate, NOT OnClose! Doing it in OnClose will prevent canceling, which is Bad!
<<ONVALIDATE> (startDate << getMaxDate),
startDate << date( startDate << getMaxDate )
);
)
)
),
H Center Box( Text Box( "end", <<SETFONTSIZE></SETFONTSIZE></ONVALIDATE>此 JSL 會關閉日曆控制項中的時間顯示,並刪除午夜之後出現的任何秒數。 JSL 也為左右控制設定了有效的日期範圍;在左側控制項中選擇日期會變更右側控制項中的最小日期,反之亦然。 今天的按鈕也被刪除。 如果您嘗試修改此 JSL 以支援時間,您會發現「今天」按鈕不會進行回調,並且它們選擇的時間不像最小和最大日期值那樣是午夜舍入的。
也可以看看
https://www.jmp.com/support/help/14-2/date-time-functions.shtml

使用一對日曆框選擇日期範圍。
回覆:使用日曆框選擇日期範圍謝謝@Craige_Hales為您解答。
此致
回覆:使用日曆框選擇日期範圍謝謝@Craige_Hales用於指出過濾器中日曆圖示的問題。每當您將滑鼠懸停在數位文字上時,都會出現該圖標,讓您可以在文字編輯或日曆編輯之間進行選擇。此問題已在未來版本中修復。正如您所指出的,日曆在當前版本中仍然有效,但在某些情況下,它不會顯示日曆圖示來暗示該功能。
回覆:使用日曆框選擇日期範圍如果你想自己做的話,試試看這樣的東西。 除了呼叫您提供的函數之外,我還讓它將兩個日曆日期初始化為該範圍,而不是今天,這似乎更有用。 您可以將日曆而不是模式視窗嵌入到報表中。
如下所示,您可以看到如何設定範圍(...)只是隱藏並排除您不想看到的數據。 它沒有與本地數據過濾器集成,但工作方式類似。
dt = New Table( "Untitled 3",
Add Rows( 367 ),
New Column( "date", Numeric, "Continuous", Format( "ddMonyyyy", 10 ), Input Format( "ddMonyyyy" ), Formula( 01Jan2020 + In Days( Row() - 1 ) ) ),
New Column( "value", Numeric, "Continuous", Format( "Best", 12 ), Formula( Random Uniform() ) )
);
gb = dt << Graph Builder(
Size( 531, 456 ),
Show Control Panel( 0 ),
Variables( X( :date ), Y( :value ) ),
Elements( Points( X, Y, Legend( 3 ) ), Line Of Fit( X, Y, Legend( 5 ) ) )
);
wait(0);
setrange=function({low,high},
dt<<SELECT hidden=""> (startDate << getMaxDate),
startDate << date( startDate << getMaxDate )
);
setrange(roundMidnight( startDate << getDate ),roundMidnight( endDate << getDate )); // callback added
)
)
),
H Center Box( Text Box( "end", <<SETFONTSIZE></SETFONTSIZE></SELECT>回覆:使用日曆框選擇日期範圍太糟糕了,我想我可以使用日曆框作為過濾器,而不是為每種類型的持續時間(月,週,年,..)設置過濾器。
感謝你的回覆。
一切順利 !
回覆:使用日曆框選擇日期範圍我不這麼認為。 使用者定義的選擇器可能是一個功能請求。
您應該能夠獲得範圍滑塊,但它不會提供大日期範圍內的單日精度。
drag the two selector controlsdrag the two selector controlsdrag the two selector controlsdrag the two selector controls拖曳兩個選擇器控件
日曆已經在那裡了,一次一張,而且很難找到。 如果將滑鼠懸停在藍線上,圖示有時會顯示您需要點擊的位置。 當您移動並單擊該圖標時,它會消失,但您仍然可以單擊它出現的位置! 當您將遊標移到日期的左側部分時,遊標也會變成手指。 (JMP 15. 16 可能更好。) @XanGregg @danschikore @奧黛麗_舒爾
回覆:使用日曆框選擇日期範圍你好,
我想使用此腳本來替換應用於圖表的本機資料過濾器。
本地資料過濾器有 3 個選擇:年、月、日。
有了2個行事曆,就更簡單了。
是否可以將其包含在本機資料過濾器中?
此致