Iterate over DC
How can I iterate over a dynamic choice similar to the dynamic multiple choice with numbers(dmc) . My use case is that I would like to auto-select the DC record if there is only one possible choice.
8 replies
-
That is an interesting question. Why would you have a dC if there is only 1 choice? But let us solve the question.
You can try this in a button:
let x := (select dCTable); let y := item(x, 0); if count(x) = 1 then dChoice2 := y end
Change the following to match your DB:
dCTable = table that the dynamic choice point to
dChoice2 = the dynamic choice field
The weird thing is I can’t put this in a Trigger. If someone else out there knows why I would be interested to know. x and y return a nid value so it should work.
-
Do you mean something like this:
-
Fred I am working on a suggestion algorithm that is based on an existing reference table to suggest the next field based on the already chosen combination and the number of occurrences in the reference table. So it is quite a dynamic algorithm that creates a selection. So that is the reason that the DC can sometimes only have one choice. In that case, it would be awesome if kind of the DC selects itself without that I need to do another lookup ^^.
-
It is possible to extend the model with dynamic selections.
-
And to put the icing on the cake, you can literally automatically select a row in the Choice field. To do this, I added Ninext project and I use an onselected event in the table's tiger can read.
function onselected() do if ChosenRecord then 'Choice (dynamic)' := number(ChosenRecord.ID) end end; true
Please, see attached exemple created from Alain Fontaine 's exemple
Content aside
- 1 yr agoLast active
- 8Replies
- 135Views
-
5
Following