• Resolved websherpa

    (@websherpa)


    This is similar to the requests regarding splitting Repeater Subfields into columns.

    Can you provide a functions.php code example for generally splitting checkbox field results into separate columns (Product Option Checkboxes is my current need) as the general Setting Settings “Multiple columns” doesn’t seem to address these.

    When output, the results of the field is the value of all checked boxes in one cell, separated by commas.

    I assume it is something like this, but I don’t know how to address these specifically by name:

    //GF Entries in EXCEL (Separate Checkbox Fields)
    add_filter('gfexcel_field_separated_checkbox', '__return_true');

    When it comes to coding, I am a freshman.

    I might suggest too, as a future feature, that you should be able to override the General Setting on each field Export Setup (as opposed to by individual hooks) for those of us with limited coding skills. ??

    Thank you!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter websherpa

    (@websherpa)

    I should mention that I can’t seem to find a resource that outlines valid values for {type} … but I can also see how the function may be useful if {type} did not need to be specified (or there was an “any” type) and the routine simply did it for any field that contains multiple values.

    Thread Starter websherpa

    (@websherpa)

    (And, by default, Gravity Forms’ CSV Export Routine will separate ALL fields with multiple values into separate columns, so it would be cool if that were the default behaviour for the General Setting as a starting point.)

    Plugin Author Doeke Norg

    (@doekenorg)

    HI @websherpa,

    To be honest, I’ve purposely changed the behavior of the checkbox to NOT be split. I felt like the behavior it has is more in line with the rest of the fields. It’s one field, that can have multiple values. However, as you’ve stated; Gravity Forms seems to disagree with me. Which is a good thing for you ??

    Just add the following snippet to your functions.php, and when you have the split setting On. You should get multiple columns for every value. When the value was selected, the value is repeated in the actual Cell. You can overwrite that with a hook to be something like “X” or “Yes / No”.

    add_filter('gfexcel_transformer_fields', function ($fields) {
        $fields['checkbox'] = 'GFExcel\Field\SeparableField';
        return $fields;
    });

    And this to change the values to Yes / No

    add_filter('gfexcel_field_checkbox_fields', function ($fields) {
        return array_map(function ($value) {
            return empty($value) ? "No" : "Yes";
        }, $fields);
    });

    I’m aware the types are not really defined properly anywhere. I want to address this in the docs site in the future.

    Hope this helps.

    Thread Starter websherpa

    (@websherpa)

    I TRULY appreciate this help from you, especially given that you may not be getting enough sleep lately!

    Since I have only just discovered this pluging and can find great value in it for my purpose, I will look for a way to compensate for your time on this.

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to Separate Product Options Checkbox Field into Columns’ is closed to new replies.