Custom Fields
Re-Envisioned
Support MB Custom Table Custom Table Feature Request

This topic contains 2 replies, has 2 voices, and was last updated by  jcleaveland 1 year, 1 month ago.

  • Creator
    Topic
  • #8280
    Resolved
    jcleaveland
    Participant

    Hi,

    I’m loving the custom tables plugin… it is really changing the way that I do things!

    I need to save arrays a comma-separated lists though (or pipe-separated lists to limit any issues associated with .csv export). I am using these tables as the backbone of an analytics platform that allows users to generate custom reports, graphs and charts based on a simple SQL query builder. The issue I am having is that any time I save anything other than a single value to that table, I have a nasty looking array to deal with in a custom query.

    I was getting ready to write my own functions to handle this, but I though that it might be easier and better to do it at the plugin level instead of overriding it with my own functions.

    I’m thinking that it should be pretty easy to explode the array on insert to the DB and then implode it any time it is needed for a standard WP function. Am I on the right track here? Is this something you would consider doing in the plugin itself instead of me adapting it after the fact?

    Thanks again for the awesome plugins and support!

    ~jason

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #8282

    Anh Tran
    Keymaster

    Hi Jason,

    We have been thinking about an way to let users define which data format is used for storing in the database. But we haven’t done it because it might affect the existing data.

    In your case, I think you can solve it with filters: before saving rwmb_{$field_id}_value and after retrieving field values rwmb_{$field_id}_field_meta.

    #8293

    jcleaveland
    Participant

    That could work. I’ll try that out.

    I like the proposed solution for a new parameter, ‘save_values_as’ => ‘json|csv|multiple’ I think that will simplify things for my use case significantly.

    I’ll keep my eyes peeled for updates on the Git issue.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.