Custom Search Criteria

Custom Search Criteria

The advanced custom_search_criteria parameter provide a way to pass to gravity form submission query, a set of filters, as defined by their API documentation here.

MaxiCharts added a simple logical layer concerning user filtering, in order to set the created_by key to value current in order to filter entries based on currently logged in WP user.

Example : filter only admin entries

[gfchartsreports color_set="purple" float="true" width="30%" color_rand="true" custom_search_criteria='{"status":"active","field_filters":{"0":{"key":"created_by","value":"1"}}}']

Compare with the same graph without filter (including all users answers).

Example 2 : date range

Shortcodes

[gfchartsreports type="horizontalBar" chart_js_options="title: {display: true, text: 'Today'}" gf_form_id="6" color_set="blue" position="float" include="1" width="32%" custom_search_criteria='{"date_range":"today"}']
[gfchartsreports type="horizontalBar" chart_js_options="title: {display: true, text: 'Yesterday'}" gf_form_id="6" color_set="blue" float="true" include="1" width="32%" custom_search_criteria='{"date_range":"yesterday"}']
[gfchartsreports type="horizontalBar" chart_js_options="title: {display: true, text: 'Last week'}" gf_form_id="6" color_set="blue" position="float" include="1" width="32%" custom_search_criteria='{"date_range":"last_week"}']
[gfchartsreports type="horizontalBar" gf_form_id="6" chart_js_options="title: {display: true, text: 'Last month'}" color_set="blue" position="float" include="1" width="48%" custom_search_criteria='{"date_range":"last_month"}']
[gfchartsreports type="horizontalBar" chart_js_options="title: {display: true, text: 'Last year'}" gf_form_id="6" color_set="blue" float="true" include="1" width="48%" custom_search_criteria='{"date_range":"last_year"}']
No answer to form User feedbacks (6) yetNo answer to form User feedbacks (6) yet

About The Author

Comments (18)

  • Joe Black

    Would you please test the date_range custom_search_criteria as they are returning the same results (at least in my case, and it looks like it in the example above as well at the moment).

    Also, can you include a “today” and “yesterday” option.

    Thank you.

    • Gravity Forms Charts Reports

      added today and yesterday : to be tested…

  • Gravity Forms Charts Reports

    Hello Joe!
    Sure i will add this! Keep you posted

  • saaidis@icloud.com

    Hello, thank you for this amazing plugin !
    Can you please explain how to do range for numbers ?

    explanation : the visitor enter his yearly income, so i have a lot of values for all visitors and i need to make range of yearly income to show them on a nice MaxiCharts.

    Thanks !

    • MaxiCharts

      Hi,
      Thanks for your feedback, what do you mean by range? Min and max? How are you planning to show this on a chart? Can you provide a link to an example page?

  • Tunox

    My first comment here, so congratulations are in order; Impecable plugin, very active maintenance and new feature additions. Ça fait plaisir 🙂
    I’m trying to achieve a chart from a gform entries and I’m wondering if it can be done at all. For the sake of the example I’ll describe something very quick. Let’s say I have a form ID = 10. One of the sections is called GAMES and within it I have 3 checkbox fields id=10 (Video-Games), id=11(Card games) and id=12(outdoor games). Each field has many choices under it (checkboxes). By default if I generate a maxi chart for fields 10, 11 and 12 it will create a separate chart for each field and its composing values which is logical.
    Is there any way to generate a chart only for the “parent” value? For example a chart with viewing only three values (Video-Games, Card games, Outdoor games).
    I tried excluding the “child ids” following gravity forms logic (gchoice_formID_fieldID_childID) but it doesn’t work.
    Any idea how to tackle this?

    • MaxiCharts

      Thanks for your feedback @tunox!
      Can you detail what you mean by :

      Is there any way to generate a chart only for the “parent” value? For example a chart with viewing only three values (Video-Games, Card games, Outdoor games).

      Please?

      • Tunox

        I’ll try to detail it better and in case I don’t manage I can always supply you with a screenshot.
        The structure of the example form id=10 is as following:
        Field 10 (label: Video Games, field type checkboxes)
        – checkbox 1 (SuperMario)
        – checkbox 2 (Packman)
        – checkbox 3 (AngryBirds)
        Field 11 (label: Card Games, field type checkboxes)
        – checkbox 1 (Red Cards)
        – checkbox 2 (Blue Cards)
        – checkbox 3 (Colorless Cards)
        Field 12 (label: Outdoor games, field type checkboxes)
        – checkbox 1 (Football)
        – checkbox 2 (Basketball)
        – checkbox 3 (Rugby)

        If I do this;
        [gfchartsreports gf_form_id="10" include="10,11,12" type="pie" color_set="blue" color_rand="0" height="400px" tooltip_style="BOTH" position="center" maxentries="500" case_insensitive="0" filter="0" custom_search_criteria='{"status":"active","field_filters":{"0":{"key":"created_by","value":"current"}}}'/]
        I’ll get 3 individual charts for each field and filled with the corrseponding children values. So for all is good.
        What I’m trying to achieve, is to display a single chart which displays;
        value 1 : how many entries in total for all video-games combined,
        value 2 : how many entries in total for all card games combined
        value 3 : how many entries in total for all outdoor games combined.
        I can easily achieve this and display the numerical values using GravityWP – Count plugin, but I was hopping for a chart view. I spent sometimes looking at GF get_entries documentation but this goes slightly beyond my skills.

      • Tunox

        Browsing through the support page of your plugin in wordpress.org, I found this: https://wordpress.org/support/topic/multiple-fields-into-one-graph/ which is almost the same thing I’m trying to achieve. Basically make one single graph from multiple fields which contain multiple choices (radio, checkboxes etc)

        • MaxiCharts

          Yes you are right, unfortunately, this feature is not available at the moment in Maxicharts…
          For counting values, you can use as well maxicharts : https://maxicharts.com/count-total-answers/
          Sorry!…

          • Tunox

            Ok thank you for the clarification and the hint on counting the total entries.
            Wish you a pleasant afternoon.

  • Jet0o

    in your Example 2 : date range
    is it possible sort “wonderfull answer field” always on the first line etc… ??

    • MaxiCharts

      Well if we fix this (as said before) you would have to order the answers inside the field. So in order to see “wonderfull” first, you would have to order id first in field. Is this what you want ?

      • Jet0o

        my problem is :
        I have 4 questions with 4 answers, (I didn’t use multi rows)
        on the Graph for example : Wonderfull can be red color or green for each question. I don’t know why.

        I would like to set a color for each answer ( green for wonderfull and red for angry for example )

        shortcode :
        [gfchartsreports gf_form_id="2" include="8,9,10,11,12" type="horizontalBar" colors="#21e5b6,#cfaf3c,#e37f32,#cb2323" color_rand="0" width="50%"  tooltip_style="BOTH" position="center" case_insensitive="0" filter="0"/]

        how can I fix this ?

      • Jet0o

        screenshot : https://i.imgur.com/tH8zVIz.jpg

        • MaxiCharts

          Ok so if graph bars are ordered the same as the field answer order you set, it should be right. Then you’ll be able to set colors and the first color will match the first answer, the second color the second, etc..
          Ok for you ?

  • Jet0o

    graph bars are ordered the same as field answer, (8/9/10/11/12)
    http://i.imgur.com/R68wqGO.jpg
    I don’t know why they ordered randomly .. depend % answer ?
    any answer should have the same color , is that I want

    • MaxiCharts

      Can you please upgrade MaxiCharts Gravity to 1.3.6+ and test ?
      Thanks

Leave Comment