We're Moving to a New Support Platform – Starting June 1st!

We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.

You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.

While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.

We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.

Thanks for your continued support and trust – we’re excited to bring you an even better support experience!

Okay
  Public Ticket #1597908
Creating more than one column in wpdatatables
Closed

Comments

  • Frank started the conversation

    I am having trouble figuring out how to add columns to a table.

    an example is:

    SELECT lx_usermeta.meta_key, lx_usermeta.meta_value FROM lx_usermeta WHERE meta_key = "wpcf-dc-license-number" OR meta_key = "wpcf-dc-license-expiration" OR meta_key = "wpcf-maryland-license-number" or meta_key = "first_name" or meta_key = "last_name"

    but this will show all the meta_key results for each wordpress database field in the same column

    I have considered you cannot add columns and that each table must be simple. I decided to try and create individual tables for each meta_value, like a table for "wpcf-dc-license-number" and "wpcf-dc-license-expiration" as two separate tables, thinking I could maybe then create a manual table and select foreign keys as the data for each column.

    My ultimate question is, can I add columns to my tables and create the sql logic they draw data from for each one? If not, can I create separate tables like I tried, and then manually create a table built with foreign keys?


    I can see that SELECT lx_usermeta.meta_key, lx_usermeta.meta_value creates a column for both lx_usermeta.meta_key and lx_usermeta.meta_value, so I get that your plugin is capable of multiple columns.

  •  472
    Isidora replied

    HI Frank,
    Thank you for your purchase.

    WordPress and its plugins store the data in a specific MySQL database, usually referred to as “WPDB”. The structure familiar to users, is based on different post types, post custom (meta) fields, and taxonomies; all stored in a collection of MySQL tables. Querying these elements, however might be somewhat of a headache to someone not that familiar with relative database structures and building SQL queries.

    wpDataTables has a built-in WPDB query constructor to help those users. It has a graphical user interface which allows a user to pick the post types, custom/meta fields, and taxonomies, and generates a query and a preview. You can modify the query as needed, and create a wpDataTable based on the modified query.

    You can read more about this on this link.

    Please note that this tool is not an ultimate query generator, it just constructs a suggestion of a query. We constantly work on improving it, but SQL is such a complicated and flexible language that full automation for constructing queries is hardly possible. So the more complicated the query is, the higher is the chance that it will not return exactly what you need.


    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables