CFV4 daily export of table data to csv and auto email

woogygun 27 Jan, 2012
Hi there

is there a way to:

On a daily basis automatically export the table data to CSV, and email it off?
GreyHead 27 Jan, 2012
Hi woodygun,

In ChronoForms alone, No.

One problem is that Joomla!, and hence ChronoForms has no sense of time and so you can't schedule things. There are plug-ins that get roudn that but the easiest way it so check if your web server supports cron jobs which allow you to specify that a PHP file should be executed at a specific time. You can then either hand-code a PHP file to do the export and mail - it's not too difficult; or if you have ChronoForms v4 then you could have the PHP file run a form event and use actions there to do the Export and mailing.

Bob
woogygun 27 Jan, 2012
Hi there GreyHead

As always thank you for the prompt response.

Im really not clued up on PHP at all. Ive done some searching i come across quite a few examples to do what i need except one point. They all export the entire database where i need only 1 table.

I do have cronjobs on my server so thats not a problem. if i can just get the php file to export the table and mail it off.

any idea's where i can file such a script?
GreyHead 27 Jan, 2012
Hi woodygun,

Let's try an experiment.

[list=a]
  • Please create a new form called say 'cron'. Use the advanced Wizard and on the Events tab go down to the bottom and create a new event called say 'export'.

  • Drag an Email action into the new event and set it up to send you a test email - all very simple.

  • Drag a custom code action into the new event and add this code:
    <?php
    $mainframe =& JFactory::getApplication();
    $mainframe->close();
    ?>


  • Save the form.

  • Set up a new cron job on your server with a frequency of say one hour and use this url
    http://mydomain.com/index.php?option=com_chronoforms&chronoform=cron&event=export&tmpl=component
    but with your domain in it.

  • Wait for a couple of hours and see if you get an email each hour. I think it should work OK.

  • Let us know what happens.
  • [/list:o]

    Bob
    This topic is locked and no more replies can be posted.