====Lookup Event====
Gets data from an event and adds it to a frame.
===Parameters===
^Name^Default^Meaning^
|source||The name of the event source|
|prefix||A prefix to be added to lookup value names|
|suffix||A suffix to be added to lookup value name|
|where||If present, this condition must be met for the lookup to happen|
|key||The name of the frame attribute used to in the lookup|
|rkey||The name of the lookup table column/property that matches the key|
|global|false|If //true//, this resource is loaded once for the entire time range|
|choose|nearest|'nearest', 'before' or 'after' adjusts which event is preferred when many are found|
|timebase|StartTime|The name of the date/time property for use in 'choose'|
===Description===
This function searches for any events that happen in or around the active time-frame and adds the event information in with the rest of the captured data.
This is often used to capture information about production batches or inspections.
This layer may cause [[frame looping|frame looping]].
===Choosing Between Multiple Matches===
The //choose// parameter specifies which event should be selected in cases where there are multiple matches.
By default, event //start// times are compared against the //start of the frame//. You can change this with the **timebase** option.
**NEAREST**: The event will be added no matter when the event was seen. \\
**BEFORE**: The event will be used only if it happens during or before the time frame.\\
**AFTER**: The event will be used only if it happens during or after the time frame.\\
//NOTE: Both 'before' and 'after' specify a **preference**. If there are several matches and the 'choose' value is "After" but all of the events happen before the frame, the **closest** match will be used instead.//
===Where===
The //where// condition is checked on the **event**. For example, events might include a 'Urgency' property with a value of 1 for urgent items.
Your layer can include a condition like...
where: "{Urgency} == 1"
...so that only those events marked as 'urgent' would be attached to the frame.
===Example===
If the frame contains the following attributes...
^Attribute^Value^
|StartTime|10:00AM|
|EndTime|11:00AM|
|Order|8830|
and we have the following events...
^Time^POrder^Quality^Final^Response^
|8:00AM|8829|Good|1|OK|
|9:00AM|8830|Bad|0|Bad Paint|
|9:20AM|8830|Bad|1|Bad Paint|
|11:15AM|8830|Good|1|OK|
|12:20AM|8831|Bad|0|Throw Out|
{
"type": "lookup_event",
"source": "Inspections"
"key": "Order",
"rkey" : "POrder",
"prefix": "Inspection ",
"where": "{Final} == 1"
}
Would result in the following...
^Attribute^Value^
|StartTime|10:00AM|
|EndTime|11:00AM|
|Order|8830|
|Inspection Quality|Good|
|Inspection Final|1|
|Inspection Response|OK|