Flatten

Converts the columns of a table into the attributes of a frame.

This deletes the table.

Parameters

NameDefaultMeaning
methodA method name
columnsAn array of column names (used only for stable and stablenz)
toleranceAn array of floating-point tolerance levels (used only for stable and stablenz)
samples2The number of samples a value must be stable for

Methods

The following methods are supported…

First: Uses the first record found in the table. Last: Uses the last record found in the table. Mid: Uses the midpoint record of the table. Stable: Uses the first value once key indicators have stablised. Stablenz: As above, but the indicators must also be non-zero. Avg: Uses the average value of all of the rows in the table.

Description

This layer is normally used to capture the activity of equipment at specific times or across periods of time.

Stability Testing

When using 'stable' or 'stablenz' as the method, only those columns that have been specifically named will be checked for stability.

You can adjust what is considered 'stable' using the 'tolerance' property. This is how much the value is allowed to change sample-to-sample in order to be considered 'different'.

By default, the layer will wait to see two samples with no changes. You can extend this further.

Example

If the frame contains the following table of data…

AttributeValue
StartTime09:00AM
EndTime10:00AM
TimeMachine.SpeedMachine.VoltageMachine.Current
09:00AM000
09:10AM02403.2
09:20AM152401.5
09:30AM182401.5
09:30AM172401.5
09:30AM17.52401.5
{
   "type": "flatten",
   "method": "first"
}

The final results will add 'Machine.Speed' at 0, 'Machine.Voltage' as 0 and 'Machine.Current' as 0.


{
   "type": "flatten",
   "method": "last"
}

The final results will add 'Machine.Speed' at 17.5, 'Machine.Voltage' as 240 and 'Machine.Current' as 1.5.


{
   "type": "flatten",
   "method": "stablenz",
   "columns": ["Machine.Voltage","Machine.Current"],
   "tolerance": [1,0.2],
   "samples": 2
}

The final results will add 'Machine.Speed' at 18, 'Machine.Voltage' as 240 and 'Machine.Current' as 1.5.