我有其他脚本,我使用日历日期框来获取日期范围,从表中选择行> =日期范围,它的工作原理。 我有一个脚本,它将无法正常工作。
我将日期存储在可变的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日午夜以来的秒数。
您要进行的比较不应使用格式化函数生成的字符串。