Dynamic multi-selection in the subform: Display of selected and unselected items.
I have an inspection form that needs to ensure all items are selected at least once. I would like to know which items are missing from the inspection in the subform. How should I handle selectedItems
and unselectedItems
? Thank you."
6 replies
-
Is the Muliple Choice field in Table1 a simple or dynamic field?
-
Well that was dumb of me, you said so in your post.
First step is to get a list of selected choices. You can try:
unique(Table1.text(multichoicefield))
This will show you the dynamic value name of all the selected choice from the dynamic choice.
Now to figure out the not selected then you will need to create two variables, an array of selected records and another array of all possible choices. You will then subtract the selected from the all possible.
Try:
let selected := unique(Table1.numbers(multichoicefield)); let allPossible := select tableroot; allPossible[(var v := this; not selected[= v])];
Line 2, you will need to put in the table name that is at the root of the dynamic multichoice field with any modifiers that are appropriate.
-
let selectedItems := join(Table1.text(MC), ",");
var BB := replace(selectedItems, " ", "");
var items := split(BB, ",");
var uniqueItems := unique(items);
var projectItems := unique(select ALL).text2;
var notCheckedItems := projectItems[not contains(uniqueItems, this)];
var result := join(notCheckedItems, ",");
if count(notCheckedItems) = 0 then
result := "OK"
else
result := join(notCheckedItems, ",")
end;
result
"I found a way. Although it's not great, it works." -
Forgot the part of showing the data:
let selected := unique(Table1.numbers(multichoicefield)); let allPossible := select tableroot; let notSelected := allPossible[(var v := this; not selected[= v])]; concat(notSelected.fieldname)
You may not have seen anything without line 4. Since it is a select, unless you tell Ninox what to show it won't show anything even if it has the records. If you change line 4 to:
concat(notSelected)
then you should see a list of nIds.
Replace fieldname to the appropriate fieldname that you want the show the data from.
-
thanks
Content aside
- 1 mth agoLast active
- 6Replies
- 77Views
-
2
Following