Best practice to access variable from transformer within {{}}?

having a hard time using variables from a transformer within {{}}:
outsideIndex = 5 const insideValue = {{query.data.id[outsideIndex]}} // getting some odd results and errors when trying to assign the insideValue

ahh yeah, it’s really confusing since it’s “all javascript” and it feels like your example should work.
but it doesn’t work because {{ }} blocks are evaluated before the transformer itself is run, and they’re evaluated in the retool context (where you have access to the retool model, e.g. query.data), not the transformer’s context. If you’re familiar with .erb or .ejs for HTML templating, it’s sort of like that.
When I write my transformers, i always do all my {{ }} assignments at the very top, to prevent me from accidentally using a transformer variable like that. e.g.
`const query1data = {{ query1.data }}
const textinputVal = {{ textinput1.value }}

// the rest of my transformer logic
…`