Skip to main content
Question

OCPM Order events of the same type

  • May 6, 2026
  • 1 reply
  • 77 views

stefania
Level 1
Forum|alt.badge.img

I created a ‘Status change’ event in OCPM and I can’t establish an order for the events that have the same timestamp. The script looks like this (I simplified it to be easier to understand):

SELECT DISTINCT 
'MeldungGeneralEvent_' || meldung_objects.QMNUM || JCDS.STAT || JCDS.UDATE || JCDS.UTIME AS "ID",
'Meldung_' || meldung_objects.QMNUM AS "Meldung",
'Meldung Status Changed' AS ActivityName,
COALESCE(SS.TXT04, US.TXT04) AS ActivityStatus,
CAST(JCDS.UDATE AS DATE) + CAST(JCDS.UTIME AS TIME) AS "Time",
CASE
WHEN COALESCE(SS.TXT04, US.TXT04) LIKE '%EGPR%' THEN 33
WHEN COALESCE(SS.TXT04, US.TXT04) LIKE '%MMAB%' THEN 34
ELSE 32
END AS Sorting,
FROM meldung_objects

To give an example, I select only the activities for Meldung number “748291035”:

The way I want my activities to be ordered is like this:

  • Time
  • Sorting
  • Alphabetical order for ActivityStatus

So the order to be: MOFN, UGPR, MAUF, MIAR, EGPR, MMAB

First, I tried to use the Sorting column in the Knowledge Model, where I defined my Event log.

But this Sorting can not be used for ‘Status Change’ events, that need to be relabeled.

Therefore, in my script defined in Tranformations in ‘Object and Events’, I added an order by clause, at the end of the select:

SELECT DISTINCT 
'MeldungGeneralEvent_' || meldung_objects.QMNUM || JCDS.STAT || JCDS.UDATE || JCDS.UTIME AS "ID",
'Meldung_' || meldung_objects.QMNUM AS "Meldung",
'Meldung Status Changed' AS ActivityName,
COALESCE(SS.TXT04, US.TXT04) AS ActivityStatus,
CAST(JCDS.UDATE AS DATE) + CAST(JCDS.UTIME AS TIME) AS "Time",
CASE
WHEN COALESCE(SS.TXT04, US.TXT04) LIKE '%EGPR%' THEN 33
WHEN COALESCE(SS.TXT04, US.TXT04) LIKE '%MMAB%' THEN 34
ELSE 32
END AS Sorting,
FROM meldung_objects
ORDER BY
Meldung,
"Time",
Sorting,
ActivityStatus

I notice that after the transformation is ran in the Data Integration, my table is not ordered, so I think ORDER BY does not work in here.

So the question is, how can I order the activities?

 

1 reply

Hi Stefania,

The Sorting column is the right mechanism — but it only works if it is explicitly mapped as the activity table’s sorting column in the data model / event log configuration. If it is not mapped, Celonis can fall back to undefined ordering for same-timestamp events, and in practice that often looks alphabetical by activity name.

So for your target order, you should assign numeric sorting values, for example:

- MOFN → 1
- UGPR → 2
- MAUF → 3
- MIAR → 4
- EGPR → 5
- MMAB → 6

 

and then make sure that column is configured as the activity table’s Sorting field. Lower value = earlier activity

What to check:
1. Open the activity table / event log configuration.
2. Verify the columns mapped are at least:
   - Case ID
   - Activity
   - Event Time
   - Sorting
3. Set your numeric order column as Sorting.
4. Reload the data model and refresh the analysis.