Problem with create new record in table using eval php in update_col plug in

mogy74

Member
Hi to everyone ,
i'm realy new in fabrik and i found this joomla component and forum very cool , so i try to set up my frist app using fabrik and reading this forum i think i did a nice job , i'm not a programmer so now i found my frist very hard problem , i wish someone can help with ideas or solution , the question is:
i have two list "list-one" and "list-two" in list-one i have set the update_col plug in and it working well , now i have to make new record in list two and it must be dome when the colum update with the plug in are done.

so my idea was put some php code in the php eval on the same plug in and it also workin well ,
the problem is i can't find the way to get data from list-one and replace in list-two's new record.

the php code i use is:


//recuperiamo i dati
$mese = $formModel->getElementData('compila_cedolino___mese');
$importo = $formModel->getElementData('compila_cedolino___totale_avere');


// Get a db connection.
$db = JFactory::getDbo();

// Create a new query object.
$query = $db->getQuery(true);

// Insert columns.
$columns = array('data_operazione','descrizione_operazione','ragione_sociale' ,'documento','tipo_pagamento','importo','sede','mese', 'anno');

// Insert values.
$values = array('1', '2', '3','4','5',"$importo",'7',"$mese",'9');

// Prepare the insert query.
$query
->insert($db->quoteName('banche_out'))
->columns($db->quoteName($columns))
->values(implode(',', $db->quote($values)));

// Reset the query using our newly populated query object.
$db->setQuery($query);

try {
// Execute the query
$result = $db->execute();
//use $db->query() in Joomla2.5
}
catch (Exception $e) {
// catch any database errors.

}
$newid = (int)$db->insertid(); //get new record id


in $values array if i set a fix number or letter it work well , but i need to have data from this row , set them as some $var and put in the $values array.

someone can help in this?
Thanks to all for read me.
 
Thank a lot!
I have read right now in other tread your solution and for my own problem my awnser in no , i din't know that plug in , now i read on wiki how it work and looks like perfect for me, when i come back home i will try to use and of course i will let you know the result, for now i just have to say thanks for the very quick reply and your professional support , this is a very great comunity, see you soon
Have a good time there
 
Hi , i saw today the upsert plug in , it could be nice but is far to do what i mean :
in fact i have those two tables where in the frist one i have stored some data like an invoce document i use in this table update_col plug in for change in list view the status from pending to paid , i would like do in a auto mode a new row in the secon table who stored the data of expenses and populate some field with the data already stored in the row i update in the frist list i thinl php eval on update plug in do what i need but my hard problem is where i can find those data , when i use this i don't leave list view , hit the update_col button i do the update in the pop up the when i apply i would create the new row in second list , now i read and try the solution you have postend in this tread http://fabrikar.com/forums/index.php?threads/update-columns-plugin-access-row-in-post-eval.41978/#post-227311 but i'm a little bit confused about .
I'm still a little bit confused about , can you be so gentle to try to make me an exemple starting with the working code i have now?
thanks for your patence , i'm a very new in fabrik :)
best wish
 
I can't really write code for folk in Community support. the example I gave on that other thread is fairly clear, you should just be able to access the data you need in $row.

-- hugh
 
I'm sorry , i din't know that , thanks anyway for your support i'll try to do my best , i will come back if can do it and i'll post the working solution for others
--hugs
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top