Step 4: Label Scripts
Without a label script, EP shows the technical key of an entity in headers, tables and the graph. A label script computes a readable name instead. Background: Key and Label Scripts.
Label Script for Movie
-
Open the entity type Movie on the tab Data Sheet.
-
Click next to Label Script. The script editor opens.
-
Enter:
local title = self.properties.title or "?"local year = self.properties.release_yearif year thenreturn title .. " (" .. year .. ")"endreturn title -
Close the editor. The script is saved.
Label Script for Actor
Do the same on the entity type Actor:
return (self.properties.first_name or "") .. " " .. (self.properties.last_name or "")
Try It
Create a new movie, or open Casablanca and change any field. The header now shows Casablanca (1942).
The label is computed when an entity is saved. Entities that existed before keep their old label until they are saved again — after Upgrade Entity Type or any change. Entities you import in the next step get the new label right away.
Next to the script editor, the AI Low Code Generator helps you write and explain scripts — for example: "Return the title followed by the release year in parentheses; leave out the year if it is empty."
Next: Step 5: Import Data