copy records from source tables to target tables and show it

maramauri

New Member
Hello,
here my problem, even a summary suggestion is precious for me.
I have the following tables:
- Origin tables: "working_cycles" + related table "working_cycle_details"
- Destination tables: "rec_working_cycle" + related table "rec_working_cycle_details"
I should copy a certain number of records (different according to the item) from the "working_cycles_details" table to the "rec_working_cycles_details" table (shown in a subform) but I would like that, at the same time to the copy, the records are visible in the subform to integrate manually other data.
I imagine that to store the data in the table I have to use the PHP plugin but in which form have I to insert it? And which event? How can how do to show the record in the subform without exit and enter again in the form?
The fields in common are in the "parent" tables and the source and destination records that I have to extract and copy are in the related tables
If it were a single record I would have used the autofill plugin but how can I proceed in the presence of multiple records?
I hope I was clear and thanks again.
Regards
 
Did you find a solution? I am in the same situation where I want to be able to migrate a group of records from one table to another. Any suggestions?
 
Have you checked form upsert plugin?
http://fabrikar.com/forums/index.php?wiki/upsert-form-plugin/

If this doesn't work in your case for some reason, then PHP form plugin run onAfterprocess will do. And of course added in your source table from which you are copying the values.

In plugin code get the variables/fields you want to copy and make two INSERT INTO queries, one for main and other for the related tabel.

Additionally if needed, you can use a redirect plugin to redirect to a record just created by the PHP-plugin.
 
Last edited:
So how would you do this with a group of records at one time? Ideally, I would like to select a group of records from a Fabrik list then insert or overwrite (matching records in the other table). Was not sure if the upsert element would do multiple records and multiple fields. The tables are in the same Joomla installation. I have a helper if needed to update the non-Fabrik table elements.
 
So you are referring to :

foreach ($ids AS $myid)
{
$row = $model->getRow($myid);
$element = $row->your-full-elementname;
$element_raw = $row->your-full-elementname_raw;
//echo "<pre>";print_r($row);
}
//exit;
 
Yes, this example is a good start combined with the wordpress article insert example.
 
Back
Top