• Payment Plugins Poll

    We need your feedback on the need for updated payment plugins. Please go here and give us your feedback.

  • Joomla 5.1

    For running J!5.1 you must install Fabrik 4.1
    See also Announcements

  • Subscription and download (Fabrik 4.1 for J!4.2+ and J!5.1) are working now

    See Announcement
    Please post subscription questions and issues here

    We have resolved the issue with the J! updater and this will be fixed in the next release.

Groups: questions and problems

marcelf

Member
Hi all,

I have used the groups feature and have some doubts /problems. I wanted to create the structure below:

Order (form)
Customer (non-repeated group)
name (element)
email (element)
Itens (repeated group)
product name (element)
price (element)

1. I have created the "Itens" group and tried to make it repeated. I have received the notice: "You can not set the group containing the list primary key to be repeatable"
Why? The primary key should exist, because Order form will need this. So I have deleted the Id element of this group.

2. I tried to include in the Order form, the Customer as non-repeated group and Itens as repeated group, but these groups dont appears in the tab Groups of Order form (form-group.png).

3. A group only appears in the tab Groups of Order form if I create it directly without a list or elements so I created the Things group (to replace Itens group) and make it repeatable after associated to Order form: order-groups.png
When I did that fabrik created a new table with a primary key: Things-table.png

4. So after config the Client and Things in the Groups tab of Order form, I created the elements for Client and Things. Note: when I created a element of Client group (non-repeated) fabrik created a column in the Order table.

5. When I went to the List page to add an Order, the add form is ok: add-order.png
But I added one order with 2 products but in the list I got this: list.png
I believe this is an error, because should the list ONE order, not one line for each product of the order.

Conclusion: maybe I am doing something wrong, but I think this feature should be more simple. It should allows set any group in the form, and in the form the admin defines if is repeatable or no, using the primary key of the associated group. In the list, the fields of a repeatable group cant be configured to Show in List to avoid show many lines for each record of repeatable group.

Thanks,
Marcel
 
About

5. When I went to the List page to add an Order, the add form is ok: add-order.png
But I added one order with 2 products but in the list I got this: list.png
I believe this is an error, because should the list ONE order, not one line for each product of the order.

If you go to Fabrik -> list -(choose your list) then go data->joins and choose "merge rows" you will get one entry per main group I.D.
 
Step by step:
Create your "order" list (will give you a list, a form, a group "order"), this is your main group containing the id element of the "order" database table.
Create a new group "customer", select "the form the group belongs to" = "order" (this is the step you missed)
Create a new group "itens", select "the form the group belongs to" = "order" , then you can set the group to be repeatable
View attachment 17391
For a repeatable groups Fabrik will create an additional table with id (primary key of the group table, not the "main" oder table) and parent_id (the foreign key pointing to your order table), + Fabrik will create a join between this tables (you'll find it in the list settings in the "Data"/Joins tab).

Alternative:
If you have already a Fabrik list e..g. itens and this list has an element (foreign key, it doesn't need to be called parent_id) pointing to your order list you can add the join manually, Fabrik will automatically create a new group order-[itens] with copies of your original itens elements.

In the list's "Join" tab set "Display data" = "merge rows" to avoid the "multiple" main data rows.
 
Hi Troester and m6xmed5,

Thank you very much, I followed yours instructions and works fine. I created another example, a company with name and workers (company-groups.png)

I could list it without the element of repeatable group (join-merge.png) or with it (join-repeatable-list-merge.png) and I have surprised fabrik could handle it so well.

I've been thinking and I've realized that group functionality can be used to represent Class Aggregation: UML_CompositionAggregation.png

Thanks,
Marcel
 
No problem :) the more you use and get used to fabrik the more uses you will find for it. It is extremely flexible.
 
Back
Top