Filter an array based on a Multichoice using another Multichoice
So I was wondering how to filter an array that will keep NId and then compare a basic multichoice with another basic multichoice.
If you open the attached DB, in Table1 on the first tab you will see what I'm trying to do.
I have a multichoice (with four choices) that match the multichoice in Table2. I have 6 records linked to the one record in Table1. I want to now filter a view element so whatever I select in the multichoice it will filter out records that don't match the selections.
I thought I could do:
let c := Table2;
let lm := numbers(pMultichoice);
c[var v := numbers(cMultichoice);
count(v[(var subv := this;
count(lm[= subv] > 0)) > 0])]
but it always returns all records.
Thanks,
3 replies
-
It's just a bad position of the brackets:
In your code, the first ">0" is placed after "lm[= subv] " and not after the count function:
c[ var v := numbers(cMultichoice); count( v[ (var subv := this; count(lm[= subv] > 0) ) > 0] ) ]
The code is correct when each ">0" is placed at the end of the count function:
c[ var v := numbers(cMultichoice); count( v[ var subv := this; count(lm[= subv]) > 0 ]) > 0 ]
-
Thanks, Jacques. It is nice to know I was on the right track. I wasn't sure if I could do the count in another count.
-
Looking back at the post that start all of this I realized that Jacques had already answered this question.
var a := numbers('Select characteristics'); select Contact where (var b := numbers('list of characteristics'); count(a[var v := this; count(b[= v]) > 0]) > 0)
I think at the time I couldn't process what was written. I don't know how many times I've re-read the post trying to make sure I understand what is going on.
Content aside
- Status Answered
- 2 yrs agoLast active
- 3Replies
- 170Views
-
2
Following