Paul,
I have tried to create related forms in tab panels dynamically, but somhow this does not work to me.
I may have come to conclusions too soon, and I will ofcourse search and test further but maybe you can explain a bit to me how you can set up these dynamically added related forms to a tabpanel.
These are basically my questions :
- Do you relate 1 to many ( parent to childs ) or the other way around
- If you relate downwards (parent to childs) but the main form has a dummy form in one tab_pannel that contains your childs and grandchilderen how do you set the related foundset of the top level of all these childeren.
- How does this relation apply to a foundset on a form that has the useSeperateFoundset marked
if you are interested in the actual situation than here is some more info :
My relations are :
one ‘special handling’ document (record) can have [0..1] prepack_manual
one ‘prepack manual’ (manifest) can have [1..x] boxes
one box can contain [1..x] styles
one style can have [1..x] sizes
I have relations :
sh_to_manifests
manifests_to_boxes
boxes_to_styles
styles_to_sizes
(It is more complex than this since each level has other relations as well, but this is the essence I want to accomplish right now. )
My servoy form layout is more or less as described in the attached image. So basically it is a main form where optionally an extra tab can be added that will show a related form. This related form is based on the related manifest form, and contains a multi purpose tab, in one of the conditions this multi purpose tab ( tab_main_workspace) can contain a form based on a dummy table, that holds the last three related tabs with their forms : boxes, styles and sizes.
But when I add the forms to their tab pannel with the addTab comment and use the related foundset I get an errormessage : java.lang.ClassCastException : com.servoy.j2db.dataprocessing.x
In the documentation they use forms.orders as form and forms_to_company as relating foundset.
Which made me think I had to set my relations the other way around from the multiple ‘child’ records to their single ‘parent’ if you like.
So I created sizes_to_styles, styles_to_boxes, boxes_to_manifests, and tried it like this, but with the same result (same error)
I used seperate foundset before and global fields to keep track of the selected records, and used the selectedrecord event to trigger a find on the “child” forms, but now I switched of the seperate foundset, I’m not exactly sure how the relation works on forms with seperate foundset switched on. But I guess it will not keep this one in sync. ( showing related entries only )
Can you tell me what I’m missing here. If the relation is downwards, than how do you start with the first one ? I’m a bit puzzeled all toghether on how this works I guess.