Work on an external table without primary ID

navjinder

New Member
Hi

I have a table which is part of another application outside joomla. It is used for one to many relation ship and many to many relationship in the application. i.e. supervisor id, subordinate id. I have created the list using the two columns in fabrik and it is displaying the results perfectly the only issue is I cannot edit or create new row because neither of the two are primary key; therefore, fabrik could not process it as it requires the primary key to save or edit the reuslts. How can I work around the primary key as I do not want to add a primary key in the external table. Thanks in advance.
 
Alright I think I have found a solution but I still need some help. So what I did is I have created a clone of the table and added the id field. And I want to use the php plugin on the form onAfterprocess to submit the new values. But as the table do not have any primary key I want to update the row based on the previous data. i.e. How can get access the old values in the form? If someone can help me in how I can access $oldfields array.

PHP:
$db = JFactory::getDbo();
 
$db = FabrikWorker::getDbo(false, 2);
 
$query = $db->getQuery(true);
 
$fields = array(
 
$db->quoteName('supervisor_number') . ' = ' . $db->quote({reportto_jom___supervisor_number}),
 
$db->quoteName('subordinate_number') . ' = '. $db->quote({reportto_jom___subordinate_number}),
 
$db->quoteName('reporting_mode') . ' = '. $db->quote({reportto_jom___reporting_mode})
 
);
 
$conditions = $oldfields;
 
$query->update($db->quoteName(emp_reportto'))->set($fields)->where($conditions);
 
$db->setQuery($query);
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top