Skip to content

Example of custom script using the SELECT statement

This example shows a custom entity script for the source Opcenter EX DS.

SELECT
CAST(0 AS smallint) as MyCustomEntitySiteId,
CAST(MyTableKey AS nvarchar(255)) as MyCustomEntityKey,
CAST(MyTableMeasure1 AS float) as MyTableMeasure1,
CAST(0 AS smallint) as EquipmentSiteId,
CAST(MyEquipmentColumn AS nvarchar(255)) as EquipmentKey,
CAST(MyRowInserted AS datetime) as RowInserted,
CAST(MyRowUpdated AS datetime) as RowUpdated
FROM [#UAFDB#].MyTable

Important recommendations

  • The RowInserted and RowUpdated columns are mandatory, as the "Smart Time Window Enabled" checkbox was selected by default in the "Edit Database" panel. If you do not include them in the script, the flows to load data are not completed correctly.
  • The FROM clause can be more complex (JOIN, GROUP etc.)
  • The first two columns represent the natural key. They must therefore be unique.

Last update: October 26, 2026