Repeat group in same database table

erigon

New Member
Good morning everybody. Thanks in advance for helping me out.

I have a form where people need to ask for a workpermit.
I have a table & form called workpermit

I have a table called workpermit_detail and both are linked with a join.
On the form I want to have multiple groups. Here comes the problem.
Whatever I do a new group gives me a new table. ...repeat. I want the data of all groups stored in my workpermit details table.

So I have three elements: action responsible person status
All possible actions are stored in one table. These actions are divided in three groups which people need to choose while filling in the form. I have everything working except that each group is stored in a identical database. Is it possible to change this to one (workpermit_detail)?

In each group I have a dropdown with:
$db = JFactory::getDbo();
$db->setQuery('SELECT id, action FROM workpermit WHERE type = 1'); //type could be 1 - 2 or 3 for the groups
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->id, $row->action);
}
return $options;

Thanks in advance.
 
Hi,

Whatever I do a new group gives me a new table. ...repeat. I want the data of all groups stored in my workpermit details table.

Just guessing, but it sounds like you created your join with a databasejoin as a "Multi Select Dropdown" field. For something like this, I think you want to use a parent, child relation ship.

WIKI

If I guessed right your issue will go away.

Regards,
Paul
 
I have a table called workpermit_detail and both are linked with a join.
On the form I want to have multiple groups. Here comes the problem.
Whatever I do a new group gives me a new table. ...repeat. I want the data of all groups stored in my workpermit details table.

When you say you "want multiple groups", I presume you mean multiple workpermit_detail groups on your workpermit form, so you set the workpermit_detail list join to be repeated?

If that's the case, then you have to have a "mapping" table, the one we automatically create, which does the many-to-many mapping between the two tables.

-- hugh
 
Yes that is what I mean.

I have one table with all the actions. Each action has a group. For instance firesafety (with 5 actions) or Personal protection (with three actions).

On the form I have the maindata and then the groups firesafety and personal protection etc..

Both the firesafety action and personal protection actions I want to store in the same table called workpermit_detail. I believe there are no many-to-many relationship there.

One workpermit has multiple workpermit_detail which are action / responsible person / status

I tested the following that I read on the forum:

I made one field on the main form: with multiple checkbox.
It then creates a new table. This is how I want the form but then I cannot add a status and responsible person in the form per action.

And I cannot show the choosable per group.

Do you guys have any idea? Thanks in advace!
 
Hi there. Thanks for the answer.

Yes I understand that part. I'm just curious if the junction table (between the many-to-many) can be the same instead of one table per group. Its just about presenting the fields in the form. Because I have 43 actions that people can chose from divided in a couple groups. I would like to store all the chosen actions in one table and fabrik creates one per group.

Or do you have any other suggestions?
 
Thanks Hugh! That wasnt the answer I hoped for but at least the answer I was looking for. Then I will look for an alternative in this case.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top