OQL Expressions Reference ✨

Expressions Overview

Tip

Expressions can be used inside aggregate, where, group by, order by, having clauses.

📦 Batch

Expression Purpose
interval.batch.yield Returns the amount of yield associated with a batch
interval.batch.start Returns the start timestamp of the batch
interval.batch.scrap Returns the amount of scrap associated with a batch
interval.run.scrap.code Returns the code associated with scrap assigned to a batch
interval.batch.name Returns the name of the batch
interval.batch.metadata.field Returns the value of the metadata field associated with the batch
interval.batch.id Returns the uuid of the batch
interval.batch.end Returns the end time of the batch or 2299-12-31 23:00:00
interval.batch Returns the uuid of the batch

🧩 Custom_interval

Custom interval types use the interval type name and optional UUID, not a generic custom_interval placeholder:

Expression Purpose
interval.<type>.value Value of the custom interval
interval.<type>.start Start time
interval.<type>.end End time
interval.<type>.metadata.<field> Metadata JSON field (string)
interval.<type>.<property> Property from the interval value JSON

Example: interval.stable_period.start, interval.stable_period.value

🏢 Factory

Expression Purpose
factory.name Returns the name of the factory
factory.id Returns the uuid of the factory

📝 Feedback

Expression Purpose
pai_feedback.id Returns the feedback uuid of a user feedback in PAI
pai_feedback.username Returns the user who gave the feedback
pai_feedback.feedback_timestamp Returns the timestamp at which the feedback was given
pai_feedback.historical Returns whether a feedback was given in historical validation mode. Returns 1 if yes, null otherwise
pai_feedback.metadata Returns the full feedback json object
pai_feedback.rating Returns the rating the user gave (0 is bad, 2 is good, null is neutral/ no feedback)
pai_feedback.comment Returns the comment entered by the user
pai_feedback.product_id Returns the product_id of the product running when the feedback was given. For historical feedback, it contains the product_id for the timeperiod being checked for historic validation
pai_feedback.stable_segment_count Returns the number of stable segments shown in PAI at the time period when feedback was given
pai_feedback.config_version Returns the PAI config version number when the feedback was given
pai_feedback.recommended_stage Returns the stage for which feedback was given
pai_feedback.recommendation_start Returns the start timestamp of the recommended period for stable period based recommendations
pai_feedback.recommendation_end Returns the end timestamp of the recommended period for stable period based recommendations

📊 KPIs

Built-in KPI references are expanded by org-specific preprocessor macros before execution. Default formulas:

Expression Default expansion
aggregation.utilization timeInIf(interval.state.type = 'Uptime') / timeInIf() — uptime seconds ÷ total query seconds
aggregation.availability timeInIf(Uptime) / (timeInIf() - timeInIf(Planned Downtime)) — uptime ÷ scheduled production time
aggregation.oee aggregation.availability × aggregation.utilization (not availability × performance × quality)
aggregation.performance Average of the performance metric configured for the line
aggregation.quality Yield-based quality ratio
aggregation.output Production output using delta-sum calculations
aggregation.yield interval.run.yield + interval.batch.yield
aggregation.scrap interval.run.scrap + interval.batch.scrap

Org-specific macro overrides may change these formulas.

🏢 Line

Expression Purpose
line.name Returns the name of the line
line.id Returns the uuid of the line
line.id_and_name Returns both the uuid and name of the line as: (‘uuid’,’name’)
line.attribute.attribute_name Filters all lines having an attribute value

🧪 Offline_quality

Expression Purpose
offline_quality.test_timestamp Returns the timestamp of when the offline measurements were taken
offline_quality.created Returns the timestamp of when the offline quality test was integrated into Oden
offline_quality.id Returns the id of the offline quality test
offline_quality.schema_id Returns the schema id of the offline quality
offline_quality.results.test_attribute Returns the value of a test_attribute in the offline_quality data. test_attribute is specified in the offline quality schema

📦 Product

Expression Purpose
product.name Returns the name of the latest product run on the line
product.id Returns the uuid of the latest product run on the line

📦 Product_attribute

Expression Purpose
product.product_attribute.value.name Returns the value of the product attribute
product.product_attribute.value Returns the uuid of the product attribute

🧩 Query

Expression Purpose
query.start Returns the start time of the whole query
query.end Returns the end time of the whole query
intersection.start Returns the value of the start time of an intersection obtained by joining multiple intervals
intersection.end Returns the value of the end time of an intersection obtained by joining multiple intervals

🧩 Run

Expression Purpose
interval.run.yield Returns the amount of yield associated with a run
interval.run.workorder.value
interval.run.target('uuid').value Returns the target of the metric specified by uuid
interval.run.target('uuid').usl Returns the upper standard limit of the metric specified by uuid
interval.run.target('uuid').lsl Returns the lower standard limit of the metric specified by uuid
interval.run.start Returns the start time of the run
interval.run.scrap Returns the amount of scrap associated with a run
interval.run.scrap.code Returns the code associated with scrap assigned to a run
interval.run.product.name Returns the name of the product in a run
interval.run.product.id Returns the uuid of the product in a run
interval.run.performance_target.value Returns the target of the performance metric
interval.run.performance_target.usl Returns the upper standard limit of the performance metric
interval.run.performance_target.lsl Returns the lower standard limit of the performance metric
interval.run.name Returns the name of the run
interval.run.metadata.field Returns the value of the metadata field associated with the run
interval.run.end Returns the end time of the run or 2299-12-31 23:00:00 if run has not ended
interval.run Returns the uuid of the run

📊 Scrap_yield

Expression Purpose
scrap.category.id Returns the id of the scrap category
scrap.category.name Returns the name of the category of scrap

⚙️ Settings

Query execution settings belong in a SETTINGS clause, not as entity expressions. See Settings.

🔧 Maintenance_work_order

Expression Purpose
maintenance_work_order.id Work order UUID
maintenance_work_order.name Work order name
maintenance_work_order.line_id Associated line UUID
maintenance_work_order.description Description text
maintenance_work_order.external_id External system identifier
maintenance_work_order.created_at Creation timestamp
maintenance_work_order.started_at Start timestamp
maintenance_work_order.completed_at Completion timestamp
maintenance_work_order.metadata.<field> Nested metadata JSON field

📅 Shift

Expression Purpose
shift.start Returns the start time of the shift
shift.name Returns the name of the shift
shift.id Returns the id of the shift
shift.end Returns the end time of the shift

🧩 State

Expression Purpose
interval.state.type Returns the state type
interval.state.start Returns the start time of the state
interval.state.reason.id Returns the reason id associated with a state event
interval.state.reason.name Returns the reason name associated with a state event
interval.state.metadata.field Returns the value of the metadata field associated with the state
interval.state.event.start Returns the start time of a state event
interval.state.event.end Returns the end time of a state event
interval.state.event.comment Returns the comment associated with a state event
interval.state.event Returns the uuid of a state event
interval.state.end Returns the end time of the state
interval.state.category.name Returns the name of the category of the state
interval.state.category.id Returns the id of the category of the state
interval.state.comment Returns state comment
interval.state Returns the uuid of the state

📅 Time

Expression Purpose
time.week Returns the week number for the week of the year
time.hour_of_day Returns 0 to 23 for 12 am to 11 pm
time.day_of_week Returns 1 to 7 for Monday to Sunday
time.day Returns the time for the start of the day
time.week Returns the week number for the week of the year
time.month Returns the month grouping value
bucket duration-granularity Time bucket for GROUP BY (e.g. bucket 1D). Units: s,m,h,D,W,M,Q,Y. M = 28 days

Expression Details

• time.week

Returns the week number for the week of the year

group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by time.week

• time.hour_of_day

Returns 0 to 23 for 12 am to 11 pm

group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by time.hour_of_day

• time.day_of_week

Returns 1 to 7 for Monday to Sunday

group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by time.day_of_week

• time.day

Returns the time for the start of the day

group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by time.day

• shift.start

Returns the start time of the shift

aggregate group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by shift.start

• shift.name

Returns the name of the shift

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by shift.name

• shift.id

Returns the id of the shift

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by shift.id

• shift.end

Returns the end time of the shift

aggregate group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by shift.end

• scrap.category.name

Returns the name of the category of scrap

aggregate

aggregate scrap.category.name
where time from now()-7D to now()
group by interval.run

• query.start

Returns the start time of the whole query

aggregate

aggregate query.start
where time from now()-7D to now()

• query.end

Returns the end time of the whole query

aggregate

aggregate query.end
where time from now()-7D to now()

• product.name

Returns the name of the latest product run on the line

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by product.name

• product.id

Returns the uuid of the latest product run on the line

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by product.id

• product.product_attribute.value.name

Returns the value of the product attribute

group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by product.product_attribute.value.name

• product.product_attribute.value

Returns the uuid of the product attribute

group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by product.product_attribute.value

• offline_quality.test_timestamp

Returns the timestamp of when the offline measurements were taken

aggregate group by

aggregate offline_quality.test_timestamp
where time from now()-7D to now()
group by offline_quality.id

• offline_quality.created

Returns the timestamp of when the offline quality test was integrated into Oden

aggregate group by

aggregate offline_quality.created
where time from now()-7D to now()
group by offline_quality.id

• offline_quality.id

Returns the id of the offline quality test

aggregate group by

aggregate offline_quality.schema_id
where time from now()-7D to now()
group by offline_quality.id

• offline_quality.schema_id

Returns the schema id of the offline quality

aggregate group by

aggregate offline_quality.schema_id
where time from now()-7D to now()
group by offline_quality.results

• offline_quality.results.test_attribute

Returns the value of a test_attribute in the offline_quality data. test_attribute is specified in the offline quality schema

aggregate group by where

aggregate offline_quality.results.test_attribute
where time from now()-7D to now()
group by offline_quality.results

• line.name

Returns the name of the line

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by line.name as linename

• line.id

Returns the uuid of the line

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by line.id as lineid

• line.id_and_name

Returns both the uuid and name of the line as: (‘uuid’,’name’)

aggregate

aggregate line.id_and_name
where time from now()-7D to now()
group by line.name as linename

• line.attribute.attribute_name

Filters all lines having an attribute value

where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
and line.attribute.attribute_name=attribute_value

• interval.state.type

Returns the state type

aggregate group by where

aggregate interval.state.type
where time from now()-7D to now()
group by interval.state.type

• interval.state.start

Returns the start time of the state

aggregate group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.state.start

• interval.state.reason.id

Returns the reason id associated with a state event

aggregate group by where

aggregate interval.state.reason.id
where time from now()-7D to now()
group by interval.state

• interval.state.reason.name

Returns the reason name associated with a state event

aggregate group by where

aggregate interval.state.reason.name
where time from now()-7D to now()
group by interval.state

• interval.state.metadata.field

Returns the value of the metadata field associated with the state

aggregate group by where

aggregate interval.state.metadata.field
where time from now()-7D to now()
group by interval.state

• interval.state.event.start

Returns the start time of a state event

aggregate

aggregate interval.state.event.start
where time from now()-7D to now()
group by interval.state

• interval.state.event.end

Returns the end time of a state event

aggregate

aggregate interval.state.event.end
where time from now()-7D to now()
group by interval.state

• interval.state.event.comment

Returns the comment associated with a state event

aggregate group by where

aggregate interval.state.event.comment
where time from now()-7D to now()
group by interval.state

• interval.state.event

Returns the uuid of a state event

aggregate group by

aggregate interval.state.event
where time from now()-7D to now()
group by interval.state

• interval.state.end

Returns the end time of the state

aggregate

aggregate interval.state.end
where time from now()-7D to now()
group by interval.state

• interval.state.category.name

Returns the name of the category of the state

group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.state.category.name

• interval.state.category.id

Returns the id of the category of the state

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.state.category.id

• interval.state.comment

Returns state comment

aggregate

aggregate interval.state.comment
where time from now()-7D to now()
group by interval.state

• interval.state

Returns the uuid of the state

aggregate group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.state

• interval.run.yield

Returns the amount of yield associated with a run

aggregate

aggregate interval.run.yield
where time from now()-7D to now()
interval.run.yield

• interval.run.workorder.value

Expression usage.

aggregate group by where

aggregate interval.run.workorder.value
where time from now()-7D to now()
group by interval.run

• interval.run.target('uuid').value

Returns the target of the metric group specified by uuid

aggregate

aggregate interval.run.target('uuid').value
where time from now()-7D to now()
group by interval.run

• interval.run.target('uuid').usl

Returns the upper standard limit of the metric group specified by uuid

aggregate

aggregate interval.run.target('uuid').usl
where time from now()-7D to now()
group by interval.run

• interval.run.target('uuid').lsl

Returns the lower standard limit of the metric group specified by uuid

aggregate

aggregate interval.run.target('uuid').lsl
where time from now()-7D to now()
group by interval.run

• interval.run.start

Returns the start time of the run

aggregate group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.run.start

• interval.run.scrap

Returns the amount of scrap associated with a run

aggregate

aggregate interval.run.scrap
where time from now()-7D to now()
group by interval.run

• interval.run.scrap.code

Returns the code associated with scrap assigned to a run

aggregate group by where

aggregate interval.run.scrap.code
where time from now()-7D to now()
group by interval.run

• interval.run.product.name

Returns the name of the product in a run

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.run.product.name

• interval.run.product.id

Returns the uuid of the product in a run

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.run.product.id

• interval.run.performance_target.value

Returns the target of the performance metric group

aggregate

aggregate interval.run.performance_target.value
where time from now()-7D to now()
group by interval.run

• interval.run.performance_target.usl

Returns the upper standard limit of the performance metric group

aggregate

aggregate interval.run.performance_target.usl
where time from now()-7D to now()
group by interval.run

• interval.run.performance_target.lsl

Returns the lower standard limit of the performance metric group

aggregate

aggregate interval.run.performance_target.lsl
where time from now()-7D to now()
group by interval.run

• interval.run.name

Returns the name of the run

aggregate group by where

aggregate interval.run.name
where time from now()-7D to now()
group by interval.run

• interval.run.metadata.field

Returns the value of the metadata field associated with the run

aggregate group by where

aggregate interval.run.metadata.field
where time from now()-7D to now()
group by interval.run

• interval.run.end

Returns the end time of the run or 2299-12-31 23:00:00 if run has not ended

aggregate

aggregate interval.run.end
where time from now()-7D to now()
group by interval.run

• interval.run

Returns the uuid of the run

aggregate group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.run

• interval.batch.yield

Returns the amount of yield associated with a batch

aggregate

aggregate interval.batch.yield
where time from now()-7D to now()
group by interval.batch.start

• interval.batch.start

Returns the start timestamp of the batch

aggregate group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.batch.start

• interval.batch.scrap

Returns the amount of scrap associated with a batch

aggregate

aggregate interval.batch.scrap
where time from now()-7D to now()
group by interval.batch.start

• interval.run.scrap.code

Returns the code associated with scrap assigned to a batch

aggregate group by where

aggregate interval.run.scrap.code
where time from now()-7D to now()
group by interval.run

• interval.batch.name

Returns the name of the batch

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.batch.name

• interval.batch.metadata.field

Returns the value of the metadata field associated with the batch

aggregate group by where

aggregate interval.batch.metadata.field
where time from now()-7D to now()
group by interval.batch

• interval.batch.id

Returns the uuid of the batch

aggregate group by where

aggregate interval.batch.id
where time from now()-7D to now()
group by interval.batch

• interval.batch.end

Returns the end time of the batch or 2299-12-31 23:00:00 if run has not ended

aggregate

aggregate interval.batch.end
where time from now()-7D to now()
group by interval.batch

• interval.batch

Returns the uuid of the batch

aggregate group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.batch

• interval.custom_interval.value

Returns the value of the custom interval

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.custom_interval.value

• interval.custom_interval.start

Returns the start time of the custom interval

aggregate group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.custom_interval.start

• interval.custom_interval.end

Returns the end time of the custom interval

aggregate

aggregate interval.custom_interval.end
where time from now()-7D to now()
group by interval.custom_interval.value

• interval.custom_interval.property

Returns the value of property from the custom_interval json object if you stored it in the value field

aggregate

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.custom_interval.property

• interval.custom_interval.metadata.property

Returns the value (as a string) of property from the custom_interval metadata JSON object

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by interval.custom_interval.metadata.property

• intersection.start

Returns the value of the start time of an intersection obtained by joining multiple intervals

aggregate

aggregate intersection.start
where time from now()-7D to now()
group by bucket 4h

• intersection.end

Returns the value of the end time of an intersection obtained by joining multiple intervals

aggregate

aggregate intersection.end
where time from now()-7D to now()
group by bucket 4h

• factory.name

Returns the name of the factory

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by factory.name

• factory.id

Returns the uuid of the factory

aggregate group by where

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by factory.id

• bucket duration-granularity

Returns a time interval. duration can take any integer values. granularity can take s,m,h,D,W,M,Q,Y. Note that M evaluates to 28 days

group by

aggregate sum(metric('uuid1')) as kpi
where time from now()-7D to now()
group by bucket 4h

• aggregation.yield

Returns the value of (interval.run.yield + interval.batch.yield)

aggregate

aggregate aggregation.yield
where time from now()-7D to now()

• aggregation.scrap

Returns the value of (interval.run.scrap + interval.batch.scrap)

aggregate

aggregate aggregation.scrap
where time from now()-7D to now()

• aggregation.quality

Returns the value of (yield / output) or (yield/(yield + scrap))

aggregate

aggregate aggregation.quality
where time from now()-7D to now()

• aggregation.performance

Returns the average value of the performance metric defined in Oden config

aggregate

aggregate aggregation.performance
where time from now()-7D to now()

• aggregation.output

Returns the value of production in a given interval (using deltasum calculations)

aggregate

aggregate aggregation.output
where time from now()-7D to now()

• aggregation.oee

Default expansion: aggregation.availability × aggregation.performance × aggregation.quality unless overridden by an org-specific macro.

aggregate

aggregate aggregation.oee
where time from now()-7D to now()

• aggregation.availability

Default expansion: uptime seconds ÷ (total time seconds − planned downtime seconds).

aggregate

aggregate aggregation.availability
where time from now()-7D to now()

• aggregation.utilization

Default expansion: uptime seconds ÷ total time seconds.

aggregate

aggregate aggregation.utilization
where time from now()-7D to now()

• pai_feedback.id

Returns the feedback uuid of a user feedback in PAI

aggregate group by

aggregate timeinif()
where time from now()-7D to now()
group by pai_feedback.id

• pai_feedback.username

Returns the user who gave the feedback

aggregate group by

aggregate pai_feedback.username
where time from now()-7D to now()

• pai_feedback.feedback_timestamp

Returns the timestamp at which the feedback was given

aggregate group by

aggregate pai_feedback.feedback_timestamp
where time from now()-7D to now()

• pai_feedback.historical

Returns whether a feedback was given in historical validation mode. Returns 1 if yes, null otherwise

aggregate

aggregate pai_feedback.historical
where time from now()-7D to now()

• pai_feedback.metadata

Returns the full feedback json object

aggregate

aggregate pai_feedback.metadata
where time from now()-7D to now()

• pai_feedback.rating

Returns the rating the user gave (0 is bad, 2 is good, null is neutral/ no feedback)

aggregate

aggregate pai_feedback.rating
where time from now()-7D to now()

• pai_feedback.comment

Returns the comment entered by the user

aggregate

aggregate pai_feedback.comment
where time from now()-7D to now()

• pai_feedback.product_id

Returns the product_id of the product running when the feedback was given. For historical feedback, it contains the product_id for the timeperiod being checked for historic validation

aggregate

aggregate pai_feedback.product_id
where time from now()-7D to now()

• pai_feedback.stable_segment_count

Returns the number of stable segments shown in PAI at the time period when feedback was given

aggregate

aggregate pai_feedback.stable_segment_count
where time from now()-7D to now()

• pai_feedback.config_version

Returns the PAI config version number when the feedback was given

aggregate

aggregate pai_feedback.config_version
where time from now()-7D to now()

• pai_feedback.recommended_stage

Returns the stage for which feedback was given

aggregate

aggregate pai_feedback.recommended_stage
where time from now()-7D to now()

• pai_feedback.recommendation_start

Returns the start timestamp of the recommended period for stable period based recommendations

aggregate

aggregate pai_feedback.recommendation_start
where time from now()-7D to now()

• pai_feedback.recommendation_end

Returns the end timestamp of the recommended period for stable period based recommendations

aggregate

aggregate pai_feedback.recommendation_end
where time from now()-7D to now()