我有其他腳本,我使用日曆日期框來獲取日期範圍,從表中選擇行> =日期範圍,它的工作原理。 我有一個腳本,它將無法正常工作。
我將日期存儲在可變的startDT2中。 分割表格後,格式與表格中的格式相匹配。 下面是代碼。
TempstartDT = start << get; // This gets the date from the Calendar/Date Box.
CharDate3= Uppercase(Format(TempstartDT, "mm/dd/yyyy"));
startDT2 = CharDate3;
dt5 << Select where (:LOGIN_DATE >= informat(startDT2,"mm/dd/yyyy"));
當我在調試器中運行代碼時,我可以看到startDT2是01/29/2019,當我選擇該日期時。 數據包含LOGIN_DATe colulumn具有01/29/2019的行。 它最終忽略了選擇位置並引入所有數據。
有誰知道為什麼Select Where不工作?
謝謝您的幫助。 我最終需要先將數據子集,然後選擇工作位置。
這段代碼有效。 我輸入了2014年12月19日之前的日期,兩行都突出顯示。
dt5 = New Table( "Test", Add Rows( 2 ),
New Column( "PRODUCT_CODE", Character( 6 ), "Nominal",
Set Values( {"11111", "222"} ), Set Display Width( 103 )
),
New Column( "LOT_NUMBER", Character, "Nominal",
Set Values( {"11111-01", "222-01"} ), Set Display Width( 88 )
),
New Column( "LOGIN_DATE", Numeric, "Continuous",
Format( "m/d/y", 12 ), Input Format( "m/d/y" ),
Set Values( [3628022400, 3631564800] ),
Set Display Width( 82 )
),
New Column( "Value", Numeric, "Nominal", Format( "Best", 12 ),
Set Values( [0.0028, 0.001] ), Set Display Width( 91 )
)
);
nw = new window("test", modal(),
start = number edit box(),
start << Set Format( Format( "m/d/y", 12 ) );
);
TempstartDT = start << get; // This gets the date from the Calendar/Date Box.
dt5 << Select where( :LOGIN_DATE >= tempstartdt);
也許在你的代碼中加入一些show()語句來看看它在做什麼?
PRODUCT_CODE LOT_NUMBER LOGIN_DATE VALUE_1
11111 12345-01 12/19/2018 0.0028
查看附件。
所有日期都以秒為單位,但您可以選擇顯示它們的方式(即m / d / y)。 您可以發布一小部分數據嗎?
LOGIN_DATE列的格式是什麼?如果它是數字(即日期),那麼您不需要轉換為字符然後返回數字日期。
TempstartDT = start << get; // This gets the date from the Calendar/Date Box.
dt5 << Select where( :LOGIN_DATE >= tempstartdt);
日曆日期框捕獲一個數值,表示自1904年1月1日午夜以來的秒數。
您要進行的比較不應使用格式化函數生成的字符串。