Stacked subforms

nvanstrien

New Member
Hi,

I have database with tables A, B (which holds a foreign key for A) and C which holds a foreign key for B) which are related by multiple levels of nesting.

For each element in table A I can have multiple instances of B. For each B I can have multiple instances called C.

I would like to create a form in which I can enter information about A, and then click through to enter information about B. In B I can click through to enter information about C.

I read the stacked subforms post that was discussed earlier, but can't seem to replicate it.

An help would be much appreciated.

Thanks,

Niels

ps: I get a message 'temporallobe.fabrik_elements' doesn't exist but it is called 'temporallobe.tml_fabrik_elements' How to correct that and what caused this mismatch?
 
This is what I would do (which I think would work although I've not tested):

Create a list join from list A to list B, setting the join to be repeatable.

This will create a group for list B. Add a database join element to it which points to list C and set it so you can add records

This will give you an initial form where you can add data into A, and add multiple related records into B. Each multiple entry for list B can also then allow you to add records into list C.
 
Hi Rob,

The solution almost works.

I can add data into A and multiple records into B, but for some reason, the data I enter in C is not stored. for each element in B I can open the C form, but is does not store whatever I enter in C.

Somehow it does not seem to autoincrement the key of C and store the foreign key of B. How can I automatically set the the foreign key field for B in C with the value of the primary key of B? Is this where the WHERE clause is used in the join?

I really appreciate if you could help me get this to work.

Thanks,

Niels
 
This is what I would do (which I think would work although I've not tested):

Create a list join from list A to list B, setting the join to be repeatable.

This will create a group for list B. Add a database join element to it which points to list C and set it so you can add records

Rob, u mean adding a databasejoin element in group "ListA[listb]" or in group "ListB"? Or is it the same thing????

Also, by saying "which points to list C" u mean that this element has to be databasejoin and it's type to be autocomplete or dropdown, pointing to table C and get value from the key-element of ListC???

"set it so you can add records" by making option "Add option in front end" --> yes, right?


This will give you an initial form where you can add data into A, and add multiple related records into B. Each multiple entry for list B can also then allow you to add records into list C.

Fully understandable but a couple of questions:

Will any new record that will be added to listC by selecting the add option(the little green "+" button)next to databasejoin element, be linked in to the related record from listB?

Can i somehow by pressing the "Select" button next to this databasejoin element, to get ONLY the records from ListC, that are related to the specific record of listB, that I am watching now??

Sorry for the questions, please ask me to provide more explanations if needed..
 
Somehow it does not seem to autoincrement the key of C and store the foreign key of B. How can I automatically set the the foreign key field for B in C with the value of the primary key of B? Is this where the WHERE clause is used in the join?vvvvv
Hmm well that isn't possible as the popup for doesn't know what primary key will be used for table B. :(
So I really don't think this is possible on a single form.

@xtrgeo as I don't think what i initially suggested would work and can't think of a way round it, your questions are kind of moot
 
My ideal situation would be.

- fill out form A (possible push apply to commit before next step).
- push a button on form A that opens form B. On opening form B, the primary key of B is autoincremented. The foreign key field for A in B is set on the basis of the selected record (= primary key of A) in form A which is still open.
- fill out form B (possible push apply to commit before next step).
- push a button on form B that opens form C. On opening form C, the primary key of C is autoincremented. The foreign key field for B in C is set on the basis of the selected record (= primary key of B) in form B which is still open.

If not directly from the Fabrik interface, do you know a way to script this?

Thank you in advance,

Niels
 
Back
Top