The described functionality is not needed in a regular QV implementation. I’ve encountered this requirement in a project where QV application was accepting selections through URL.
Standard selection behavior:
If a user makes selections in several fields, and there are mutually exclusive selections, then the last selection overrides the previous selections. User can see that he is making selection of the excluded values, and understands the consequences.
It is needed when the selections are sent to the QV applications from outside by URL. User doesn’t know beforehand if the selections are made in the excluded values. If selections in several fields are mutually exclusive, all selections must be cleared at the end.
- Define the list of fields in which the selections to be made. In the example, the fields are A, B, and C.
- Add two isolated fields (islands) in your data model to define start and end of the selection process. Let call them Start and End. The amount and content of values of these fields doesn’t matter, one value may be sufficient for our purpose.
- Create a set of variables, one per each field plus one additional:
- MXT (Mutual eXclusion Test)
- Create Actions
On field Start on Select:
- Clear All
- Set Variable vA to 0
- Set Variable vB to 0
- Set Variable vC to 0
- Set Variable MXT to 0
On field A on Select – Set Variable vA to 1 (or you may use =GetSelectedCount(A))
On field A on Change – Set Variable =if(GetSelectedCount(A)=0 AND vA>0, ‘MXT’) to 1
Repeat for fields B, and C.
On field End on Select:
- Clear Field =if(MXT=1,’A’)
- Clear Field =if(MXT=1,’B’)
- Clear Field =if(MXT=1,’C’)
Before actual selections (fields A, B, and C), a selection in the field Start must be made. It clears the existing selections and sets variables to 0.
When a selection is made in a field, the appropriate variable is set to 1, indicating this way the fact of selection in the field.
If a selection in this field was made before, and there is a change to “no selections” in this field – variable MTX is set to 1.
After all selections are made, the test is completed, triggered by the auxiliary selection in the Field End. If the MTX=1, all fields that participate in selections are cleared. Nothing happens if MTX=0.
The order of selections: always begin with Start and finish with End. The other fields may be selected in any order.