我有包含用户选择的列的列表。
这些已经是数字,但是我想找到具有时间或日期格式的数字,因为它们需要特殊处理。
如何使用JSL过滤它们?
这是执行此操作的一种方法的示例。 该脚本打开一个数据表,查找所有连续的数字列名称,然后删除发现其格式为所列日期和日期时间格式之一的名称。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Aircraft Incidents.jmp" );
colList = dt << get column names( string, numeric, continuous );
// Create a list of the date and datetime formats to check for
dateList = {"m/d/y", "mmddyyyy", "m/d/y h:m", "m/d/y h:m"};
show("All Numeric List", colList );
For( i = N Items( colList ), i >= 1, i--,
If(
Contains(
dateList,
Word( 2, Char( Column( dt, colList[i] ) << get format ), "(,\!"" )
),
show(Word( 2, Char( Column( dt, colList ) << get format ), "(,\!"" ));
Remove From( colList, i, 1 )
)
);
show("\!nList with Date columns removed", colList );我还可以将日期更改为整数(自开始日期起的秒数)。
考虑到我可以有100.000行和几百列,最好更改已经具有数值的数据表中所有列的格式?