This documentation applies to version 2.6 and later
Summary of Shortcode Options
||Required. Designates the form to display. All rows and columns are displayed by default|
||Make short code only display output for user’s with minimum-required role. Choices are
WARNING: this setting is overridden by plugin setting in WP Admin page Contact -> Database Options -> Can See Submission when using shortcodes
||Limits columns to be shown to be those designated (comma-delimited list)|
||Does not show listed columns (comma-delimited list)|
||One number: limit=”10″ means show first 10 rows. Is the same as limit=”0,10″
Two Numbers: limit=”100,10″ means show 10 rows starting at row #100)
||Display 2 random rows from those that the short code finds. (Since 2.4)|
||Sort rows by designated columns. Use “column-name desc” to sort in descending (reverse) order|
||Select rows to display that have any cell with the search text in it (case insensitive). Intended to mimic behavior of the “Search” field in the DataTable|
||Select which rows to display based on filter expression. More powerful than “search”, it can filter on multiple columns with boolean and regular expressions. If both “search” and “filter” are specified, “search” is ignored.|
|Options specific to this shortcode|
||Can be: count, min, max, sum, mean, percent.
Use in conjunction with filter and show to select the rows and columns containing the data to input into the function.
WARNING: you generally want to pick ONLY ONE row in “show”. If you do not, all returned values will be used.
||When multiple values are returned by the shortcode, by default they are printed with a ‘, ‘ delimiting them. Use this option to change that delimiter.|
Don’t want a table or JSON? Just want to put a value in the page? Use the
[cfdb-value form="your-form" show="field1" filter="Submitted Login=$user_login"]
would display the field1 form value for the currently viewing user (who would have needed to be logged in when he submitted…see documentation on $user_login variable substitution).
The intention is to specify one column/field in
showand specify a
filterthat would select on submission. (see how this works for
[cfdb-table]) But if you specify more columns or have more submissions (rows) resulting in the filter, then this shortcode will print out a comma-delimited list of values. You can also use
[cfdb-value function="count" form="myform"]
Count entries in column “col1″:
[cfdb-value function="count" form="myform" show="col1"]
Minimum entry in column “col1″:
[cfdb-value function="min" form="myform" show="col1"]
Maximum entry in column “col1″:
[cfdb-value function="max" form="myform" show="col1"]
Sum of entries in column “col1″:
[cfdb-value function="sum" form="myform" show="col1"]
Mean of entries in column “col1″:
[cfdb-value function="mean" form="myform" show="col1"]
Available as of version 1.8.4. Specify a delimiter to be put between multiple values. Note: if you are using a function then it will always return one value, so there will never be a delimiter. So ‘function’ and ‘delimiter’ are mutually exclusive.
[cfdb-value form="myform" show="col1" delimiter="|"]
In this case, if there is more than one entry in the DB for this form, all the “col1″ values will printed delimited with a “|”, e.g. “submission1-col1|submission2-col1|submission3-col1″
NOTE: if you want more complex formatting of the output, use the
[cfdb-html] shortcode instead.
Returns a percentage value of the (number of form entries matching your show and filter criteria) / (total number of form submissions for the form).
Limitation: this is always a percent of the total number of entries in the database. However, you can create a short code to compute a percentage on a subset of a form’s submissions.