Record set selection
This feature is part of the Visforms Subscription and not available in the free Visforms version..
We propose reading the documentation from the beginning, starting with the Introduction. We will not repeat concepts and explanations made in previous parts of the documentation, here.
You can use user input values to select, which record sets are displayed in the data view. You need a form field with distinct values for that purpose, i.e. a select, a radio or a checkbox or you can use the Visforms content plugin Form View to create and populate a field with specific default values, that can be used for the record set selection.
You use the plugin parameter fieldselect
for record set selection.
Unlike the other plugin parameters the parameter fieldselect
expects itself a list of name-value-pairs, requiering the same syntax as described in the Syntax rules of the plugin string. Use the field id as name and one of the unique field values as value in this name-value-pair. In addition you can use specific variables, i.e. to select for the url of the current page or the username of the logged in user.
Please note, that only fields with the field option "allow frontend data view" set to a value, that allows the data display, are can be used in the fieldselect option.
The following "fieldselect" parameter selects record sets which have "green" as value of the field with the id 3 and and "yes" as value of the field with the id 5.
"fieldselect":{"3":"green","5":"yes"}
How to use the parameter fieldselect
in the plugin string
{vfdataview}{"formid":"6","fieldselect":{"1":"1","5":"green"},"fieldlist":"1,2,3,5","layout":"list"}{/vfdataview}
Using variables in record set selection
Instead of a distict value (like "green") you can use specific variables in the record set selection. The following fieldset parameter select all record sets which contains the url of the current page as value of the field with id 1.
"fieldselect":{"1":"[_url]"}
The plugin supports the following variables in record set selection:
- [_url]: url of current page
- [_name]: name of logged in user
- [_username]: user name of logged in user
- [_email]: email of logged in user
You can use the Form View Plugin in order to create a (hidden) field and set the url of the current page as default in this field. You can use the default value options for fields of type text respectively type email to set name, username or email of a logged in user as a default in your form. Set the field option "readonly" to true, to prevent the user from changing these default values. Thus you will be able to create fields with the proper values for your records set selection in the data view plugin.