Clearing selection for one field is easy: {$<FIELD=>}
Clearing all field selections is also easy: {1}
For keeping only one field selection this looks promising at first glance: {1<FIELD=P({$}FIELD)>}, but it is potentially problematic because selections in other fields might influence what are the possible values for FIELD.
I could type all the set modifiers {$<FIELD1=,FIELD2=,...>} except for the field selection I want to keep, but I might have hundreds of fields, so this is hardly convenient. Also I am afraid I might hit some sort of size limit for the expression text.
This: {1<FIELD=FIELD>} also does not work.
My current solution uses some rather confusingly looking formulas in variables, but this breaks expression syntax highlighting and, more worryingly, relies on the fact that set modifiers are evaluated left-to-right (for example, {$<FIELD={'A'},FIELD={'B'}>} is equivalent to {$<FIELD={'B'}>}), which is hardly a documented feature and might just stop working at some time in the future or under some circumstances I have not yet encountered.
So, is there any simple and elegant way to do this, that I am missing?
In case anybody sees that thread: Alternate States + Set Analysis had since made this super-simple and way less messy.
Use {1<FIELD=$::FIELD>} as the set expression and you are done.
This is also one of the limitations that I have noticed. I have used {<Field=P()>} to only recognize one fields selections, but I still need to tell people that while this may make it so that only this field affects it, it is only showing the possible values in this field. I am also interested in a different solution where it only changes results based on actual selection and not on possible values.
Hi
What about using GetSelectedValues to collect the seleacted values as a list in a variable, and incorporating that variable into your set expression?
Regards
Jonathan
Yes, I think it might be a better idea than what I have right now.
For the interested:
Contents of variable Selection:
chr(39)&GetFieldSelections($1,chr(39)&','&chr(39),1000)&chr(39)
Set definition:
{1<FIELD={$(=$(Selection(FIELD)))}>}
It does not break syntax coloring and does not rely on modifying one field twice, so is better in both aspect from what I had.
Thanks! Still, I cannot help thinking there should be some easier way of doing that 😉
In case anybody sees that thread: Alternate States + Set Analysis had since made this super-simple and way less messy.
Use {1<FIELD=$::FIELD>} as the set expression and you are done.