[SOLVED] : Repeat Items' rows within the database are inserted out of order

hominid4

Member
I have two lists/tables:

table_events
id | event_name

table_activities
id | event_row_id | activity_name | activity_date

'table_activities' is joined into 'table_events' (event_row_id -> id) as a repeat group.

When submitting these (for example) actities within the repeate group:

Activity 1 | 2024-01-01
Activity 2 | 2024-01-02
Activity 3 | 2024-01-03
Activity 4 | 2024-01-04

It'll submit to the Db table 'table_activities' with the correct consecutive auto-increment 'id's, however the rows of the new inserted rows within the Db 'table_activities' will be out of order, as example:

id | event_row_id | activity_name | activity_date
328 | 6 | Activity 1 | 2024-01-01
330 | 6 | Activity 3 | 2024-01-03
331 | 6 | Activity 4 | 2024-01-04
329 | 6 | Activity 2 | 2024-01-02

And therefore when I go back and edit a previous entry the repeat items within the form's repeat group will be in a different order than what I entered, being ordered by how the rows are ordered within the Db table. Within 'phpMyAdmin -> Operations -> Alter table order by: id' fixes the ordering on the front-end within the form, however on the next submit the new inserted repeat items' rows are out of order. The previous 'Alter table' rows are in the correct order, just the newly inserted rows are not.

The activities do not show in list view, only in the form.

Is this normal behaivor of repeat group items and maybe a phpMyAdmin issue? If normal, anyone have a suggestion on applying an onSumbit code that orders the repeate item rows by the 'id', or such?

Thanks!
Joomla v5.0.3
Fabrik v4.0 (release date: 2024-02-01)
 
Ah, well I be. I did try the 'AND' ordering under 'list -> Data -> Data tab -> Order by' but wasn't having luck as of yet. Thanks for the lead however, to try again, I removed all my 'list -> Data -> Data tab -> Order by' that I had in there (event_date DESC, is_copy DESC, activity_date ASC - I have other columns than what I listed as an example above), I put them back in in the order of 'is_copy DESC, event_date DESC, activity_date ASC' and now it is indeed ordering correctly the activities in ASC order by activity_date within the form itself as needed. Thanks again for the lead on that, I should have thought to play around more with the ordering of the elements within the 'order by' but when I tried initially I ruled it out.

The repeat items are still inserted out of order within the database repeat table, as the example above, but they are ordering correctly now within the form due to the 'order by' setting. Out of curiosity, I assume that is more of a SQL insert, possibly phpMyAdmin, issue and just the way it is than having to do with anything with the insert coding that the Fabrik form does when inserting into the repeat table?

Thanks again!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top