Custom search criteria – Filter by Field Values

Custom search criteria – Filter by Field Values

After an interesting question from academicdigital on the support forum, i would like to show now how to filter results by field values.

Show results of field number “2”, but only for users that have answered “10” to field number “3”

[gfchartsreports color_rand="true" include="2" chart_js_options="title: {display: true, text: 'Filtered: have answered 10 to question of field 3'}" custom_search_criteria='{"status":"active","field_filters":{"0":{"key":"3","value":"10"}}}' float="true" type="doughnut" height="400px" ][gfchartsreports color_rand="true" chart_js_options="title: {display: true, text: 'NOT Filtered: all answers'}" include="2" float="true" type="doughnut" height="400px" ]

About The Author

Comments (8)

  • Tunox

    In the above example shortcode how do we target the wanted form? Adding formid=”12″ doesn’t solve anything. The shortcode still goes looking for the custom search criteria on the first form created formid=”1″ (in my case the contact form). Obviouly this throws a “No answer to form Contact (1) yet” error.

  • June


    I have a question here, how do we set AND condition logic in the above example? I have tried to filter my entries as the following but the result is not specified to the condition I want:

    [gfchartsreports color_rand="true" include="1" custom_search_criteria='{"status":"active","field_filters":{"0":{"key":"2","value":"Project A","key":"3","value":"Female"}}}' float="true" type="pie" height="450px" ]

    where field 1 is Property Type, field 2 is Project Name, field 3 is Gender.

    I would like to show results of Property Type but only for users that have answered Project A to field number 2 AND Female to field number 3

    Any idea for this?

  • June

    Exactly ! Thank you very much!

Leave Comment