A One to Many Challenge

peterk900

Member
I want to show some stock records where a record may have associated pallet details. I have been working through the 1 to Many video tutorial and have replicated what I want to do.
Fabrik_2405a.png

Above is the end result very similar I think to the tutorial end product. StockTranID 1943 shows 5 associated pallets - all the rest have none.

Fabrik2405m.png

Opening the associated form for view/amend gives the stock data and the associated pallets.

Clicking the green Add button correctly adds a new pallet record with the correct Stock Ref Id.

Whist this would work, the display of stock records is a little untidy because each record has its own header which provides no useful information and therefore doubles the length of the list. Also records with pallets duplicate the stock data.

Is there any way to produce something like the dummied-up design below? Here the pallet data is not shown until you open up the form ( the world multiple identifes stock spread over several pallets ) . The list is easily changeable to remove the pallet details and the grouping. However how do you remove the multiple entries for stock with pallets yet include this information in the edit/view forms ?

Fabrik2405d.png

Another possibility might be something like this - where the group header contains more information than simply the PK value ?

fabrik2405k.png

Any thoughts on alternative ways of presenting this data in a user friendly way whilst working within the design framework of Fabrik would be good. If what I'm aiming for is not possible 'out-of-the-box' then any pointers to custom code within Fabrik would be helpful.

Thanks.
 
Form:
just edit the repeat group and set Template = table in "Repeat" tab.

List:
set Display mode = merge rows in Data/Joins
 
Wow ! This exceeded my expectations by a mile. This meets every need without a single line of code. What gems are hidden behind the multitude of tabs !

Here is some documentation on the results and the way of achieving them that you pointed me towards.

The Form with the many items nicely laid out.
fabrik2405n.png
The list with no repeating stock data and all the related items clearly displayed.
fabrik2405p.png

The changes to the Form:

fabrik2405q.png

The changes to the List:

fabrik2405r.png
Thanks again for this and for coming back so quickly.
 
I'm struggling to remove the add and delete buttons on the one-to-many form - marked in green
fabrik2405t.png

I thought the way to do it was to set the Access to Special - as shown below.

Fabrik2405s.png
I've solved stopping the creation on any entry at the "one" (the stock transaction) level by making fields read-only.

Fabrik2405u.png

After the monumental progress I've made with forum help I was a little disappointed I couldn't make this work. How can I stop users adding a record from the main form - they can only create records which link to existing stock - and also from deleting at the "one" level - the "many" form provides its own delete button which works brilliantly. Thanks.
 
What an idiot - my tests were in the back end. When I add the list to the front end the add and delete buttons have gone.


fabrik_2505e.png

This really is encouraging ! The list will of course look a lot better when I move the navigation.
 
Yup. "Special" is access levels from usergroup "author" up (so if you are logged in in frontend you'll see the buttons again).
I always add an accesslevel "nobody" (and use it eg. for "empty" list access).

BTW: there are also access settings in groups for add/remove buttons, for general group display
 
Thanks for the 'nobody' idea. And also for the reminder about Group access settings.

I've noticed that I cannot delete the last 'many' in a 1 to many situation. See below:
Fabrik2605a.png

One thought I had was trying to place some code behind the button to do the delete outside Fabrik but I haven't found any way to link code to these buttons.. A solution within Fabrik would of course be better.
 
Thanks once again troester. The Group Min and Max values are blank in the default display but blank as you say must mean 1. Also the Group to change is the db join group - in my case with a db join between two database tables tblStockItems (1) and tblStockPallets (many) the group is tblStockItems-[tblStockPallets]. Once again, it is very encouraging to see what can be achieved without any code. I've just realised that the help button on the Repeat tab explains what the Repeat Max and Repeat Min do !
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top