嗨,在这里我遇到了一个问题。 我有两张桌子。 一个是有 847 行记录的主表。 它每隔一分钟记录一次。现在我希望我可以单击 JSL 一次,以便每隔一分钟有一行自动从主表移动到表 2。 这意味着 60 分钟后,表 2 中有 60 行。 120 分钟后,Tables2 中有 120 行。 直到847分钟后结束。
先谢谢了。
人
这是一个简化的示例,说明如何按分钟进行更新。如果你稍微玩一下它,你应该得到你需要的
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Reduce the number of rows to a reasonable number for the test
dt << select rows( {1, 2, 3} );
dt << invert row selection;
dt << delete rows;
// Create the output table
dt2 = New Table( "update",
New Column( "time updated", Format( "d/m/y h:m:s", 17 ) ),
New Column( "Name", character )
);
Wait( 0 );
// Set the initial values
begin = Today();
TheRow = -1; // set to -1 so first row will be immediatly written
// Loop until the minute has changed, then update
While( TheRow + 2 <= N Rows( dt ),
If( Date Difference( begin, Today(), "Minute", "actual" ) > TheRow,
dt2 << Begin Data Update;
dt2 << Add Rows( 1 );
dt2:time updated[N Rows( dt2 )] = Today();
dt2:Name[N Rows( dt2 )] = dt:Name[TheRow + 2];
dt2 << End Data Update;
Wait(55);
TheRow++;
);
// This is optional, but it should reduce the cpu cycle impact if used
Wait(1);
);