Skip to main content

mes.fnGetModeEventData

Description

Returns production mode event data for a given asset within a time range.

Syntax

mes.fnGetModeEventData(@assetId, @startDate, @endDate)

Parameters:
  • @assetId (int): Asset Id (nullable)
  • @startDate (datetime): Start of the time range (nullable)
  • @endDate (datetime): End of the time range (nullable)

  • Returns:
    Returns a table with columns:
  • modeEventId (int): Mode event Id
  • modeCode (nvarchar(50)): Mode code
  • assetId (int): Asset Id
  • workOrderId (int): Work order Id
  • itemId (int): Item Id
  • counterId (int): Counter Id
  • startDate (datetime): Start timestamp
  • endDate (datetime): End timestamp
  • Code Example

    -- Get mode events for a specific asset and time range
    SELECT *
    FROM mes.fnGetModeEventData(2076, '2025-07-01T00:00:00', '2025-07-30T23:59:59');