Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mots 44 posts 75 karma points
    Dec 06, 2010 @ 13:04
    mots
    0

    Automatic export of data

    Hi,

    I know that we can export data from Umbraco Contour manually, but is there a way to set up a process whereby it automatically exports the data to a CSV/Excel file on a daily/weekly/monthly schedule?

    Thanks.

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Dec 06, 2010 @ 16:31
    Tim
    0

    Yes, it should be pretty straightforward. There's a couple of ways you could do this.

    1) Write a custom .aspx page that does the export and call it using Richard Soettman's excellent Scheduled Task Package: http://our.umbraco.org/projects/developer-tools/taskscheduler

    2) Write an .exe file and schedule it using the Windows Task Scheduler (requires you to have access to the server the site is on)

    You could use the Contour API to filter the data if you wanted as well. For example we have some tasks that export all entries for a form for the last month to csv and then email them to various clients, based on some selections in the form. The developer docs in the Contour download section on Umbraco.org have some good example code of how to work with Contour data programatically.

    Hope that helps!

    :)

    Tim.

  • Dean 55 posts 98 karma points
    Mar 18, 2011 @ 01:54
    Dean
    0

    Hello Tim,

    I need to do this and was heading down the scheduled task path. It is the generation of the csv data that i'm wondering about.

    Is there a method on some object that I can call that will generate the csv data for a form for me in memory which I can then attach to an email, or do I need to generate the csv with custom code. The only way I know how to do that would be to loop through records, fields and values. That doesn't sound very performant.

    Would you mind giving me a brief overview of the strategy you took to this, as what you have done is exactly what I need to do.

    Thanks

    Dean.

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Mar 18, 2011 @ 09:57
    Tim
    0

    The latest versions of Contour have an export to CSV fearure, that uses XSLT to transform the records into CSV for download (there's a toolbar in the top right of thelist entries page that allows you to download the selected data in a viariety of formats). You could have a look at the XSLT file that powers that, and look at doing the same (effectively getting the XML using the library methods and then doing an XSLT transform to turn it into CSV format). I think that would be more efficient than looping through the records! We looped through the records, but it's not very performant, especially on a busy form with a lot of entries. I'm going to be switching it over to the above method at some point in the near future!

    :)

Please Sign in or register to post replies

Write your reply to:

Draft