• Resolved dsbking

    (@dsbking)


    Hi,

    Love the plugin; thanks for all the hard work you’ve put into it!

    One thing I’ve spotted – and am not sure if this is intentional or not – is the fact that if you create a view in the database (e.g. CREATE VIEW ‘view_name’ AS SELECT etc.) you can happily view the “table” both on the front end and the back end, but you can’t export the data from the “table” at all, unlike an actual table in the database. Is this expected or a bug?

    What I’d like to be able to do is use a view to create the data table I require and then allow this to be exported in the various different forms as it needs to be used to export an Excel file for mail merge, as an example.

    If you look at the data explorer on the back end and select “Manage” for a table you get a long list of options for the table, including “EXPORT”, but doing the same for a “table” created by a view in the database only shows two options: “RENAME” and “DROP”.

    It’d be great if the option to export the data for a view was available.

    Thanks

    Darren

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Darren,

    That’s a great idea! 🙂 I love it!

    I will add the export to Excel, CSV, XML and JSON feature for views. I’ll let you know when it is available.

    Thank you for this interesting feature request!

    Best regards,
    Peter

    Thread Starter dsbking

    (@dsbking)

    Hi Peter,

    That’s great to hear and thanks for being so responsive and open to new requests.

    Thanks

    Darren

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Darren,

    Your feature request is available in the next version. If you want to use it right away, you can download the actual development release from Bitbucket. If you don’t mind you can wait untill the next version is released. I’ll let you know if you want to.

    Thank you very much for your interesting contribution Darren! 🙂

    Best regards,
    Peter

    Thread Starter dsbking

    (@dsbking)

    Wow! Thanks for the quick turn around.

    I’ve downloaded the source from Bitbucket and uploaded it and it looks to be working great in the Data Explorer view.

    Is there a way this can be added to the front end as well so that anonymous users can do an export of data as well, i.e. users who don’t have access to the WordPress back end, much like you can with tables on the front end? If you could do that then that would tick all of the boxes and – I would like to think – make this a very powerful feature to allow access to complicated data lookups without actually having to understand or do anything with the database.

    Thank you so much for the great plugin as it’s making my life putting together an administration WordPress app for a charity so much easier!

    Thanks

    Darren

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Darren,

    Great you downloaded the latest release from Bitbucket! 😉

    Export on the front-end is already available, but with limitations. It only works for pages of type table. It does not work in parent/child pages. That is on my to do list…

    To allow anonymous users to export your tables or views from your website:
    – create a Data Project
    – add a table or view to your project
    – set the page mode to view (set the page to read-only)
    – add your Data Projects page to your website with shortcode wpdadiehard

    Users can now export the base table data to SQL, JSON, XML, CSV and Excel. Make sure you disable checkbox “Use roles in shortcode wpdadiehard (Data Projects)” in Plugin Settings > Manage Roles. If you enable this checkbox anonymous users will not be able to access the page.

    Hope this helps!

    Best regards,
    Peter

    Thread Starter dsbking

    (@dsbking)

    Hi Peter,

    Thanks for the quick response again.

    Hm? The instructions you’ve given above don’t appear to be working for me as I’d done all of that except setting the page mode to “view”, which I’ve now changed. I still don’t see the bulk actions drop down with the export option. I even tried adding the bulk_actions_enabled=”true” and bulk_export_enabled=”true” options to the shortcode to see if these would force the issue but that didn’t work either.

    I’m going to be offline for a couple of days so won’t be able to look into this further to see if it’s something I’ve done wrong but wanted to reply to let you know what I’m seeing at the moment.

    When I’m back online I’ll grab screenshots of my plugin options, page set up etc. so that you can check that I’ve got everything set up okay.

    Thanks again for the quick reply.

    Darren

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Darren,

    Sorry, I misunderstood you. You are trying to use the bulk options with a view, right? Bulk options don’t work with views. For bulk actions you need a unique key to identify rows. A view has no unique key. The export from the Data Explorer main page (via the Manage link) does a full table/view export and therefor doesn’t need a unique key.

    This subject has been on my mind some time ago when the table settings option was not yet available. I think there might be a possibility to use the table settings feature to create some kind of unique key definition for views within the plugin. It’s an interesting feature but it will take some time to implement. I’ll do some research and let you know.

    Thanks again for your contribution! 😉

    Best regards,
    Peter

    Thread Starter dsbking

    (@dsbking)

    Hi,

    No worries. I’ve managed to work round the problem with a bit of JavaScript that takes the table on the page and exports it to a CSV file format so I can use that for now to allow the exports on the pages where it’s needed for views.

    Thanks again for the help.

    Darren

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Database view can’t be exported’ is closed to new replies.