Support » Plugin: Gravity Forms Entries in Excel » Include all fields – checkboxes/radio buttons, empty or not

  • Resolved toll02

    (@toll02)


    Hi
    I am finding the plugin really helpful but have a question regarding one of my forms.

    One of my forms (a ‘trip request form’) uses several check boxes and radio button fields to provide the user with choices. For example, a choice of country and then a selection of golf courses in an area. Is there anyway to provide a complete list of all the options available in the form that if enabled by me would then provide an export containing a column for all the options for each of these fields, irrespective of which option the user has chosen and whether they are empty or not? ie. Similar to the way the inbuilt gravity form import/export function currently presents this kind of form for export? I have a list of fields I always exclude and so would find your plugin really helpful to set this up ‘once’ and then run it every week.

    I currently use the export function to download the last week of entries and then add this to a master spreadsheet of all the past entries (obviously different users select different fields depending on their requirements). A condensed version of selected only fields loses the overall ‘column structure’ and so makes copy/paste of the latest completed entries/rows to the master tricky and time consuming.

    Does that makes sense …? It would be easily demonstrated with a screen dump of the Gravity export screen Vs the dashboard of the plugin …

    Many thanks

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Doeke Norg

    (@doekenorg)

    Hi @toll02,

    Glad you like the plugin. I saw your review. Thank you very much 🙂

    I like your idea. I like it so much, I already have this on a roadmap :-). But I’ve decided to postpone new features for a while. Reason for this is that I’m currently in the process of rebuilding the entire plugin from te ground up. Why? Because the plugin has evolved over the past few years, and incrementally it became this somewhat unstructured thing. To make my life “easier” I’ve decided to build it again, with every feature it currently has + a few more. This new setup allows me to add new features in a more elegant way, which makes it easier for me to maintain (the new code is fully under test for instance).

    This change also allows me to make a PRO version next to this (Free) version. The PRO version will be build ONTOP of the Free version, making it easier for me to maintain both, and fix bugs in both plugins at the same time.

    In full transparency; it is this PRO version’s roadmap that this feature is on. (Using a Feed per form to add multiple export presets to download). And you’ve probably guest it, but this PRO version will be a paid plugin.

    But to be honest, I’m not sure how soon this will all be released. This is a side-project for me. I have a full time job, 2 kids, and just.. stuff 🙂 So I’m not committing to any time-frame.

    BUT I WANT TO HELP YOU! So let’s see. If it is just one form, and you know exactly what fields (ID’s) you want, you can make use of the gfexcel_field_disable-hook to disable the fields you do not want. We can put that behind a query-string you can append to the url. Something like: <url>/gf-entries-in-excel/<hash>?type=simple. The ?type=simple will trigger the disabling. We can also combine this with an automatic date-filter, or you can just use the normal filters for that.

    Is that something you can work with and build? If not let me know; I’d be more than happy to help out a little bit with that.

    Thanks again for your prompt reply. Understood re development and the pro version.
    I have only used the most simple version of filtering via the URL you describe to set dates. So, is there a way to get certain fields to export in full using the features you describe above (on a form by form basis rather than universally)?
    For example:
    My form number=18
    example fields – a checkbox field (ID=20), a radio button field (ID=3) and a Dropdown field (ID=4).
    Most of the fields I want to exclude are meta fields like IP address so presumably I do that from within the plugin dashboard for the form?
    If you could give me a sample pattern to look at I’d obviously be happy to have a go to adapt it.

    Many thanks.

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @toll02 ,

    Here is an example you can use to disable / enable only the fields that you want for Form 18. (This will only be triggered if you have ?type=simple added to the url of that form).

    I haven’t tested it, but it should work 😀

    add_filter('gfexcel_field_disable', function ($disabled, \GF_Field $field) {
        // Don't change anything if your form is not 18
        // or if you've not added "?type=simple" to the url.
        if ($field->formId != 18 || rgar($_GET, 'type') !== 'simple') {
            return $disabled;
        }
    
        // Show only fields that are in this array.
        $enabled_field_ids = [3, 4, 20];
    
        // Disable field if it is not in the array.
        return !in_array($field->id, $enabled_field_ids);
    }, 10, 2);

    Hope this helps you out.

    Yes, very helpful, thank you.
    After some experimenting I have what will work well for me but could you help me include one of the meta fields in my output? I’d like “date of entry” if possible. I tried looking at the underlying source for the form in the gravity export page. Found:
    <li><input type="checkbox" id="export_field_74" name="export_field[]" value="date_created" class="form_export_field"> <label for="export_field_74">Entry Date</label></li>
    but can’t see how to use the value provided here, unlike my user input fields that in the other lines of code have an identifiable number.

    This is what I have in the part of my functions file that specifies the fields:

    // Show only fields that are in this array.
       $enabled_field_ids = [20, 2, 3, 4, 5, 6, 7, 12, 14, 16, 15, 17, 18, 25, 9, 10, 11, 30, 41];

    This is like the URL I am using with it:
    https://mywebsite.com/gf-entries-in-excel/2b910066919014c0350bc3d324eabe37fcc6da29a6fda3f8ab908472c27e9400?type=simple&start_date=2019-11-01&end_date=2019-11-10

    Many thanks

    Plugin Author Doeke Norg

    (@doekenorg)

    In that case you can just add it betweeen quotes to the array. Like this:

    // Show only fields that are in this array.
       $enabled_field_ids = [20, 2, 3, 4, 5, 6, 7, 12, 14, 16, 15, 17, 18, 25, 9, 10, 11, 30, 41, 'date_created'];
    • This reply was modified 8 months, 3 weeks ago by Doeke Norg.

    Perfect. Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Include all fields – checkboxes/radio buttons, empty or not’ is closed to new replies.