I have a rather long form where about 30 inputs are initially populated using ternary operators. I could use something like this:
dmx-bind:value="serverconnect1.data.query.some_field?serverconnect1.data.query.some_field:serverconnect1.data.query.some_otherfield"
… but it would be preferable to use a more concise version:
dmx-bind:value="some_field?some_field:some_otherfield"
Apart from being shorter, it’s also easier to read, debug, edit and create etc.
I could wrap the form in a repeat - then I could simply use the names as in version 2. Unfortunately, this doesn’t work with Single Record queries (or can it be made to work?). I might change the query, but the API file is used in quite a few other places… Also, it’s not ideal; I’m not repeating anything.
I thought of using a DataDetail component, but that doesn’t improve things much - eg column names would be prefixed like this:
data_detail1.data.some_field
(I would have thought the context was unambiguous in this case. I wonder if the prefix is necessary.)
It’s not a very important issue but there’s some intrinsically unsatisfactory about cluttering up the code using the ‘default’ version. Perhaps I’ve overlooked an alternative or more sensible approach. I would be interested in any suggestions.
Last updated: