• Resolved Dan Waldschmidt

    (@danielpw)


    I’m struggling to format the Address field the way I need it to appear in the export. By default, the Address fields are all being combined into one field, which is what I want. But each separate address field is just getting added as a new line in the final combined field so it ends up looking like:

    Address Line 1
    City
    State
    Zip
    Country

    I need the single Address field to be formatted as:
    Address Line 1
    City, State Zip

    I’ve hooked into the ‘gfexcel_field_value’ filter but it’s not an array of fields that is getting passed into my function, it’s just a String of the already formatted value for the Address field with each field already on it’s own line.

    Could you point me in the right direction for getting my Address field in the format I need? Thanks!

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

    (@doekenorg)

    Hi @danielpw,

    Sure thing!

    The default behavior of the plugin is to concatenate all fields in to one. But you can enable the separation on the global settings page of Gravity Forms. There is an ‘entries in excel’ tab too. One of the first settings is to enable separated fields.

    Let me know if this helps!

    Plugin Author Doeke Norg

    (@doekenorg)

    @danielpw, i’m sorry I was too quick to reply. I didn’t read your message correctly. My bad, was half asleep ??

    let me check it out. I’ll get back to you.

    Plugin Author Doeke Norg

    (@doekenorg)

    @danielpw, please checkout this page: https://gfexcel.doeken.org/docs/changing-values/

    The second variable is the entry, which contains all the available fields. You can return a string, formatted exactly how you want, be using the keys of that array.

    But you need to add something like this:

    add_filter('gfexcel_field_value', function ($value, $entry, $field) {
        // $value is the string value of this field
        // $entry is an array of the entire row in the Excel file
        // $field is an instance of GF_Field
    
        return $value; // alter this, or completely rewrite it. 
    }, 10, 3); // 3 refers to the number of arguments.
    Thread Starter Dan Waldschmidt

    (@danielpw)

    Hey @doekenorg,

    Thanks so much for the help! I hadn’t even noticed those pages of documentation so I apologize for that.

    This is working great.

    Thanks again,
    Dan

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @danielpw,

    Those docs are brand new, so no need to apologise ??

    Glad it worked out!

    Plugin Author Doeke Norg

    (@doekenorg)

    To anyone wanting to do the same:

    I’ve added a recipe to make this very easy. Enjoy!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Formatting Combined Address Value’ is closed to new replies.