• Resolved ryankn

    (@ryankn)


    Hey Doeke,
    I made a dropdown list in GF and added my own values after the choices. In the export I’d like to see the choices, but it displays the values of a choice.
    Hope the screenshot helps clearing it up: https://snipboard.io/C0EHlS.jpg

    Kind regards,
    Ryan

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

    (@doekenorg)

    Hi @ryankn,

    Het is maar goed dat ik Nederlands ben, anders had ik je screenshot misschien niet gesnapt 😉

    For everyone else reading along; I think this should be easier in the future, but for now you should be able to use this hook in your functions.php.

    add_filter('gfexcel_export_field_value_checkbox', function ($gform_value, $form_id, $input_id, $entry) {
        $field = \GFAPI::get_field($form_id, $input_id);
    
        return $field->get_value_export($entry, $input_id, true);
    }, 10, 4);

    Hope this helps you out. Succes ermee!

    Thread Starter ryankn

    (@ryankn)

    Hi Doeke,
    Thanks for you quick response! Glad you understood the screenshot:)
    When I use your code, there is no change unfortunately.
    Should I put the form id (65) and the field ids (20, 21 and 22) somewhere in the code? If so, where exactly?

    Thanks again!

    Kind regards,
    Ryan

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @ryankn ,

    This will make it more strict.

    add_filter('gfexcel_export_field_value_checkbox', function ($gform_value, $form_id, $input_id, $entry) {
        // If this is not form 65 or not field 20, 21, or 22 keep the original value.
        if ((int) $form_id !== 65 || !in_array((int) $input_id, [20, 21, 22], true)) {
            return $gform_value;
        }
        
        // Otherwise, return the label instead of the value.
        $field = \GFAPI::get_field($form_id, $input_id);
    
        return $field->get_value_export($entry, $input_id, true);
    }, 10, 4);

    This filter does not have the extra params, but this code should meet your exact needs.

    Thread Starter ryankn

    (@ryankn)

    Thanks for the quick response! I used the code, but somehow it still shows the values instead of the labels in the Excel export.

    Kind regards,
    Ryan

    Plugin Author Doeke Norg

    (@doekenorg)

    @ryankn can you send me a .json export of your form to info@gfexcel.com? I’ll take a closer look

    Thread Starter ryankn

    (@ryankn)

    @doekenorg Just sent you an email 🙂

    Plugin Author Doeke Norg

    (@doekenorg)

    Resolved behind the scenes.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Use label instead of value in export’ is closed to new replies.