Why do newly created elements get inserted in the left joined table.

Status
Not open for further replies.

dealio

Member
Why do newly created elements within a group that is linked to joined list always get inserted in the left joined table and not the outer table? What dictates which table the field gets created?

===steps====
1. create two lists, "table1" and "table2"
2. inner join them called "joinList1"
3. create a group "group1" and assign it to "joinList1".
4. create an element "first_name" and assign it to "group1"
5. notice it will create the "first_name" field in "table1". Why not in "table2" ?

- Lets say I had originally a "first_name" field in "table2" and ran the above steps. "table1" and" table2" both have "first_name."

How do you dictate which table new elements get created in joined lists?


I'm trying to group up lot of fields to make use of the tabs in the fabrik forms. But since my list is based on a join any parent element I reassign to the new group(s) will error out (sql error) which i think is per design. So then I'll start from scratch and create a new element and assign to to one of the new groups, however as in the steps above it the element always gets created in "table1" the left table of the join instead of getting created in table2. How do you group element in "table2" I only see grouping based on join unless it s stand alone non joined list based on one table; then you can create groups and move elements around because there is no second table.

Hope I'm making sense.

thanks
 
1. create two lists, "table1" and "table2"
2. inner join them called "joinList1"
Not sure what you are doing. Did you add a join to list "table1"? What did you call "joinList1" (list "table1", form "table1")?

Adding a join to "table1" will create a group table1-[table2] containing all elements of table2.
 
Adding a join to "table1" will create a group table1-[table2] containing all elements of table2.

Yes, your correct, so now If I were to use the bootstrap tab form, the elemetns in table1 are in the first tab and the second group of elements are in the "table1-[table2]" tab like below.


==========Example Setup==================

----database tables----
table1
-------
id|report_no

table2
-------
id| name | hair_color



----joined list-----
Joined to created "joinList1"


-----form configuration-----
Bootstrap tabs form template based on list "joinList1"

tab1
---------------------
shows "table1" group
field:report_no

tab2
--------------------------
shows "table1-[table2]" group

field: name
field: hair_color
=====================================


Everything works great. But now I'm trying to move the "hair_color" element into its own group called "person attributes"


Here is an example of what I'm trying to achieve:

====Final Form Output==================
Bootstrap tabs form template based on list "joinList1"

tab1
---------------------
Group: "table1"
field:report_no

tab2
--------------------------
Group: "table1-[table2]"
field: name

tab3
--------------------------
Group:"person attributes"
field: hair_color
=============================================

1. If this form was based on a non joined list, you can simply create a new group "person attributes" and re-assign the "hair_color" element to it, and would works beautifully.


However, since this is based on a joined list("joinList1") this is what happens when trying to do the same.

a. If I re-assign the "hair_color" element to group "person attributes" it throws an error when trying to save the form. Which I think is per design.

b. If I create a new element "hair_color" and assign it to group "person attributes" its works fine. However when I look at the database the field "hair_color" gets created in table1(list table1). So now I have two database tables with the same field name "hair_color" .

----database tables now show----
table1
-------
id|report_no| hair_color <--do not want fabrik to create "hair_color" in this table

table2
-------
id| name | hair_color

How do I tell fabirik to utilized the "hair_color"field in table2 instead of creating the same field in table1



I know the proper way is to duplicate the "joinList1" then call it "person attributes" and then join it on itself. unpublished all elements except for "hair_color". But is there is a way to accomplish this without list copying.

In my case I have about a hundred fields and need to several groups (8 groups). I have to copy the list to represent each group to preserve the parent/child element database field linking to. But this method creates a tremendous amount of child elements.
 
are those groups repeatable? If they aren't then you could get away with writing a custom template which places each element in any tab.
 
Oh I see that makes sense. I ended up making a custom form template and putting each elements into their groups.

Thanks
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top