Lookup Event

Gets data from an event and adds it to a frame.

Parameters

NameDefaultMeaning
sourceThe name of the event source
prefixA prefix to be added to lookup value names
sufffixA suffix to be added to lookup value name
whereIf present, this condition must be met for the lookup to happen
keyThe name of the frame attribute used to in the lookup
rkeyThe name of the lookup table column/property that matches the key
urlThe URL to download the content from
globalfalseIf true, this resource is loaded once for the entire time range
choosenearest'nearest', 'before' or 'after' adjusts which event is preferred when many are found
timebaseStartTimeThe 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.

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…

AttributeValue
StartTime10:00AM
EndTime11:00AM
Order8830

and we have the following events…

TimePOrderQualityFinalResponse
8:00AM8829Good1OK
9:00AM8830Bad0Bad Paint
9:20AM8830Bad1Bad Paint
11:15AM8830Good1OK
12:20AM8831Bad0Throw Out
{
   "type": "lookup_event",
   "source": "Inspections"
   "key": "Order",
   "rkey" : "POrder",
   "prefix": "Inspection ",
   "where": "{Final} == 1"
}

Would result in the following…

AttributeValue
StartTime10:00AM
EndTime11:00AM
Order8830
Inspection QualityGood
Inspection Final1
Inspection ResponseOK