To avoid “dynamic timezone” limitations in OQL, a practical workaround is to build one UNION ALL query by looping over your TimeZones (not over the data rows). The idea is to generate one long OQL string in a microflow and then execute it once for your export.
First, retrieve the list of System.TimeZone objects that are actually used by your Plant records (for example: retrieve Plants, then build a distinct list of their linked TimeZones). This keeps the query smaller and avoids generating blocks for timezones you don’t use.
Next, iterate over that TimeZone list. In each iteration, append one OQL “block” that (1) hard-codes the timezone code inside the conversion function and (2) filters the dataset to only the plants that belong to that timezone. After each block (except the first), add UNION ALL.
Finally, pass the completed OQL string to Execute OQL Statement.
Example (template/pseudo):
SELECT O.OrderID, DATEPART(hour, O.OrderDate, 'Europe/Berlin') AS LocalHour FROM MyModule.Order O JOIN O/MyModule.Order_Plant/MyModule.Plant P WHERE P/MyModule.Plant_TimeZone = <TimeZoneId> UNION ALL SELECT O.OrderID, DATEPART(hour, O.OrderDate, 'Asia/Shanghai') AS LocalHour FROM MyModule.Order O JOIN O/MyModule.Order_Plant/MyModule.Plant P WHERE P/MyModule.Plant_TimeZone = <TimeZoneId>