IntervalMatch
IntervalMatch 前缀用于创建表格以便将离散数值与一个或多个数值间隔进行匹配,并且任选匹配一个或多个额外关键值。
Syntax:
IntervalMatch (matchfield)(loadstatement | selectstatement )
IntervalMatch (matchfield,keyfield1 [ , keyfield2, ... keyfield5 ] ) (loadstatement | selectstatement )
时间间隔可以重叠,离散值可以链接所有匹配的时间间隔。
扩展
要避免未定义的时间间隔限值遭到忽略,可能必须让
Arguments:
参数 | 说明 |
---|---|
|
一个字段,包含链接至时间间隔的离散数值。 |
|
一个字段,包含转换中匹配的额外属性。 |
|
必会生成一个表格,其中第一个字段包含每个时间间隔的下半部限制,第二个字段包含每个时间间隔的上半部限制,如果使用关键字匹配,则第三个及此后的任何字段包含显示于 IntervalMatch 语句中的关键字段值。时间间隔总是封闭区间,即间隔的端点包括在时间间隔之中。非数值限值会导致时间间隔遭到忽略(未定义)。 |
Example 1:
以下两个表格中,第一个表格定义了不同订单生产的开始时间和结束时间。第二个表格列出了众多离散事件。借助 IntervalMatch 前缀,可以逻辑连接两个表格,从而找出哪些订单受到干扰的影响,哪些订单依据哪次轮班处理。
LOAD * Inline [
Time, Event, Comment
00:00, 0, Start of shift 1
01:18, 1, Line stop
02:23, 2, Line restart 50%
04:15, 3, Line speed 100%
08:00, 4, Start of shift 2
11:43, 5, End of production
];
OrderLog:
LOAD * INLINE [
Start, End, Order
01:00, 03:35, A
02:30, 07:58, B
03:04, 10:27, C
07:23, 11:43, D
];
//Link the field Time to the time intervals defined by the fields Start and End.
Inner Join IntervalMatch ( Time )
LOAD Start, End
Resident OrderLog;
结果:
表格 OrderLog 现在包含额外一列:Time。记录的数量也可以扩展。
Time | Start | End | Order |
---|---|---|---|
00:00 |
- | - | - |
01:18 | 01:00 | 03:35 | A |
02:23 | 01:00 | 03:35 | A |
04:15 | 02:30 | 07:58 | B |
04:15 | 03:04 | 10:27 | C |
08:00 | 03:04 | 10:27 | C |
08:00 | 07:23 | 11:43 | D |
11:43 | 07:23 |
11:43 |
D |
Example 2: (使用
与上述示例相同,添加 ProductionLine 作为关键字段。
结果:
现在可以按照以下方式创建表格框:
ProductionLine | Time | Event | Comment | Order | Start | End |
---|---|---|---|---|---|---|
P1 |
00:00 |
0 | Start of shift 1 | - | - | - |
P2 | 01:00 | 0 | Start of shift 1 | - | - | - |
P1 | 01:18 | 1 | Line stop | A | 01:00 | 03:35 |
P1 | 02:23 | 2 | Line restart 50% | A | 01:00 | 03:35 |
P1 | 04:15 | 3 | Line speed 100% | B | 02:30 | 07:58 |
P1 | 04:15 | 3 | Line speed 100% | C | 03:04 | 10:27 |
P1 | 08:00 | 4 | Start of shift 2 | C | 03:04 | 10:27 |
P2 | 09:00 | 4 | Start of shift 2 | D | 07:23 | 11:43 |
P1 | 11:43 | 5 | End of production | - | - | - |
P2 | 11:43 | 5 | End of production | D | 07:23 | 11:43 |