• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Rowid of new record

Mono

Member
I understand that there is no rowid of a new record until it has been saved.

In the past when needing this (MS Access) I have used a form to INSERT INTO a table, then grabbed the PK and opened the record just created.

Can someone point me in the right direction?

I have been reading up on this but I can't seem to implement it

http://fabrikar.com/forums/index.ph...g-current-row-id-on-calc-in-new-record.32813/

I see Hugh has worked round it before and I'd love to know how.

https://github.com/Fabrik/fabrik/issues/668

Thanks
 
Would a form redirect plugin help? On the redirect just redirect back to the fabrik form in detail/view mode with the row_id which should be available to you in the redirect plugin. Not sure if this is the best way to do it but might get you started.
 
Hi Hugh
I have a form 'fault sheet' with repeat groups that indicate multiple 'areas where a fault can occur' and for each of the repeat groups the user may have to enter multiple descriptions of faults.
See here, and thanks again.
http://fabrikar.com/forums/index.ph...ues-in-repeat-groups.48400/page-2#post-261223

So it was my plan to have a button in the repeat group to click when there is a 'fault', that opens another form with repeating groups where the user can enter the descriptions of the fault. This would be stored in a joined table.

To do that I think I need the PK of the 'fault sheet' so that I can create a junction table with 'fault descriptions'.
If you will I need a repeat group within every repeat group, am I making any sense?
 
So is the issue when you are trying to add the "multiple descriptions" for a new "fault", ie. hit the "Add" button on the repeat group, you now have a new repeat (which will be created as a new row in the joined table for that group), but as yet has no id?

-- hugh
 
I have already got the fault area id in a hidden field on my repeat group, the user enters the description.
Then I want to get the parent form id and these 3 items go in my join table.
 
[TBL Inspection]------------------[TBL Join]-----------[TBL Fault area]
User ---------------------------------- Description of --------------Wheels
Date----------------------------------- fault observed---------------Engine
Vehicle---------------------------------TBL INS PK
------------------------------------------TBL Fault area PK----------------------
 
Last edited:
U can access the record that u just have created with {rowid}. And if you want to access your joined records from a detail view of your parent-table, then u might use this URL:

<a href="index.php/yourlistmenuname/list/45?yourlistname___yourelementname_raw=<?php echo $example1raw;?>&limitstart45=0&resetfilters=1&fabrik_incsessionfilters=0"><?php echo $example1;?></a>

45 = the id of your list you want to access

This link you can copy in your detail view template
 
I have already got the fault area id in a hidden field on my repeat group, the user enters the description.
Then I want to get the parent form id and these 3 items go in my join table.

What I'm confused about is that if you are trying to build a kind of "repeat within a repeat", then that second level of repeat needs to have an FK (foreign key) that points to the PK (primary key) of the first level of repeat, not the form itself.

The structure is kinda ...

Main table has PK of 'id' (PK, the rowid)
First level of repeat is a table that has id (PK), parent_id (FK) and value
Second level of repeat is a table that has id (PK), parent_id (FK) and value

Main Table PK (rowid) <= first level of repeat has parent_id pointing to main table PK (rowid) <= second level of repeat has parent_id pointing to id of second level of repeat.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top