TMDL View: One Command per Apply
Symptom
I generated a TMDL script with one createOrReplace per relationship, 21 in total, pasted it into TMDL view and pressed Apply. This is the limit I ran into. I did not record the exact error text, so I can’t quote it.
Cause
TMDL view accepts only one command per Apply. Twenty-one commands in one script is twenty commands too many.
Fix
Use a single createOrReplace and list every relationship as a sibling underneath it:
createOrReplace
relationship r_one
fromColumn: ...
toColumn: ...
relationship r_two
fromColumn: ...
toColumn: ...
Apply that once.
Two Typing Notes from the Same Session
- If you type into the editor instead of pasting, it copies the previous line’s leading whitespace on every newline. Type only the extra tabs for each deeper level, or the indentation drifts.
- Paste keeps indentation exactly as it is in the clipboard. If you build the text in a script, put the right number of tabs in yourself: measure at two, expression body at four, properties at three under
createOrReplace.
How I Proved It
After I restructured the script, the relationships applied from one Apply. Twenty went in that way. The 21st, the downtime reason relationship, had been left out because its key column was the wrong type, and I applied it in a separate script once that was fixed (see the Direct Lake Double key note). Apply also validates references, so a typo in a column name fails there instead of later.