Select some values in a field
Select some values in a field by using the SelectValues method or the LowLevelSelect method.
Examples
Example 1:
In this example, the first step is to create a list object which contains one field (the field: Country). After checking that no values in the field Country are selected, the handle of the field Country is retrieved and some selections are made in the field. The last step is to check the layout of the list object in order to see the selected values.
1. Create a transient list object with the identifier (qId): ListObject01. The list object contains one field (qFieldDefs): Country.
The client sends:
The engine returns:
The list object is created and the handle is 2.
2. Get the layout of the list object. The handle of the request is 2 because the handle of the list object is 2.
The client sends:
The engine returns:
All values are in the optional state. The element numbers are returned in qDataPages/qMatrix. In this example, the country United States has 0 as the element number.
3. Get the handle of the field Country.
The client sends:
The engine returns:
The handle of the field Country is 3.
4. Select the values of element numbers 0 and 1 (respectively United States and Denmark).
The client sends:
The engine returns:
The selections are successful. The two first values in the field are selected.
5. Get the layout of the list object. The handle of the request is 2 because the handle of the list object is 2.
The client sends:
The engine returns:
The values United States and Denmark are selected.
Example 2:
In this example, the first step is to create a list object which contains one field (the field: Country). After checking that no values in the field Country are selected, the handle of the field Country is retrieved and some selections are made in the field. The last step is to check the layout of the list object in order to see the selected values.
1. Create a transient list object with the identifier (qId): ListObject01. The list object contains one field (qFieldDefs): Country. The initial data fetch (qInitialDataFetch) is made of the first 5 lines (qHeight is 5) starting from the top (qTop is 0).
The client sends:
The engine returns:
The list object is created and the handle is 2.
2. Get the layout of the list object. The handle of the request is 2 because the handle of the list object is 2.
The client sends:
The engine returns:
All values are in the optional state.
3. Get the handle of the field Country.
The client sends:
The engine returns:
The handle of the field Country is 3.
4. Select the values Denmark and Canada.
The client sends:
The engine returns:
The selections are successful (qReturn is true).
5. Get the layout of the list object to check that the values Denmark and Canada are selected. The handle of the request is 2 because the handle of the list object is 2.
The client sends:
The engine returns:
The values Canada and Denmark are selected. The other values are excluded.