repeater not saved in the 2nd table

Fredolino 01 Apr, 2019
Hi,

I have a form in which is also a repeater with input fields.
The form part not in the repeater is stored in a table.
The repeater content is stored in another table.
The repeater part is in a loop event, the other part is not.

My tests have shown that the part is stored outside the repeater in Table 1
becomes.
The part in the repeater is not saved in the 2nd table.
But my 2nd table is extended by the columns that are in the repeater.

What should I do?

Many thanks for your help.

F.
healyhatman 01 Apr, 2019
You should post a screenshot of your save data actions and paste your debug output.
Fredolino 02 Apr, 2019
Hi,

Thank you for your help.
Here are the screens.

many Greetings
F.
[file=11880]screen1.jpg[/file]
​[file=11881]screen2.jpg[/file]
healyhatman 02 Apr, 2019
That's the OUTSIDE of your save data action mate, you need to show me the inside of it. Also show me the settings of your loop event action.

And don't post a screenshot of your debug, copy and paste the text.
Fredolino 02 Apr, 2019
ok :-)

	
Array
(
    [chronoform] => beobachtungen
    [event] => submit
    [Fund] => Array
        (
            [datum] => 2019-04-19
            [teilnehmer] => teilnehmer
            [datenweitergabe] => 2
        )

    [Data25] => Array
        (
            [fundort] => Wandlitz , 
        )

    [Data26] => Array
        (
            [beobachter] => Super User
        )

    [Arten] => Array
        (
            [species] => pruni, Rhagades, (Denis & Schiffermüller, 1775)
        )

    [Art] => Array
        (
            [1] => Array
                (
                    [anzahl] => 2
                    [bemerkung] => bemerku
                    [photo] => 
                )

        )

    [select19] => Imago
    [select20] => männl
    [select21] => Am Licht
    [select22] => Augenschein
    [button13] => 
    [8cd96a265a46e007f7cfe1f554be7f0b] => eb25105f12278542a55c322661391c07
    [4e5ecaa84cfeae5bd080b3ed74a4d811] => d2d68dafefe1581100e49caac0825c8e
    [joomla_user_state] => logged_in
    [Itemid] => 128
    [option] => com_content
    [view] => article
    [id] => 1
    [beobachtungen] => 
)
Array
(
    [validate_fields10] => Array
        (
            [log] => Automatic validation enabled.
            [var] => 1
        )

    [save_data17] => Array
        (
            [data] => Array
                (
                    [datum] => 2019-04-19
                    [teilnehmer] => teilnehmer
                    [datenweitergabe] => 2
                    [created] => 2019-04-02 13:28:53
                    [user_id] => 909
                    [beo_id] => {id.title}
                    [fundort] => Wandlitz , 
                    [beobachter] => Super User
                    [species] => pruni, Rhagades, (Denis & Schiffermüller, 1775)
                    [anzahl] => {"1":"2"}
                    [select19] => Imago
                    [select20] => männl
                    [select21] => Am Licht
                    [select22] => Augenschein
                    [bemerkung] => {"1":"bemerku"}
                    [photo] => {"1":""}
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `mtb_beobachtung_fundort` (`datum`, `teilnehmer`, `datenweitergabe`, `created`, `user_id`, `beo_id`, `fundort`, `beobachter`)  values  ('2019-04-19', 'teilnehmer', '2', '2019-04-02 13:28:53', '909', '{id.title}', 'Wandlitz , ', 'Super User');
                )

            [var] => Array
                (
                    [datum] => 2019-04-19
                    [teilnehmer] => teilnehmer
                    [datenweitergabe] => 2
                    [created] => 2019-04-02 13:28:53
                    [user_id] => 909
                    [beo_id] => {id.title}
                    [fundort] => Wandlitz , 
                    [beobachter] => Super User
                )

        )

)



​[file=11883]Firefox_Screenshot_2019-04-02T13-38-35.018Z.png[/file]
Fredolino 03 Apr, 2019
Hi,

the data records from the repeater area are now entered in my second table (subtable).
Do I have to insert a hidden field in the form that takes the ID of the 1st table (main table) into the 2nd table (subtable)?
Otherwise, the records from the repeater area will not be assigned to the first table (main table).
Or do I have to make a new model for the 2nd table (subtable / repeater area) in the setup area in the Read Data for loading the 1st table (main table)?

many Greetings
F.
healyhatman 03 Apr, 2019
The first save data action with generate a new primary key id. So just use {var:save_data#.id replace#with the number of your save data action and id with the name of your first save data action's id field
Fredolino 03 Apr, 2019
[color=rgb(0, 0, 0)]Hi,

Thank you for your help. I think I have communication problems.[/color]
There is always only one record stored in the second table, although I have selected more records in the repeater.
I have now in the Save Data action for the subtable in Data overrides:
beo_id[br]{var:save_data17.beo_id}[br]on insert

The Debugger:
Array
(
    [chronoform] => beobachtungen
    [event] => submit
    [Fund] => Array
        (
            [datum] => 2019-04-04
            [teilnehmer] => 
            [datenweitergabe] => 1
        )

    [Data25] => Array
        (
            [fundort] => Wandlitz , 
        )

    [Data26] => Array
        (
            [beobachter] => Super User
        )

    [Modela] => Array
        (
            [1] => Array
                (
                    [species] => amasina, Rhagades, (Herrich-Schäffer, 1851)
                    [anzahl] => 
                    [stadium] => Imago
                    [geschlecht] => männl
                    [beobachtung] => Am Licht
                    [bestimmung] => Augenschein
                    [bemerkung] => 
                    [photo] => 
                )

        )

    [button13] => 
    [8cd96a265a46e007f7cfe1f554be7f0b] => ff0494d743eb5f7aebf4511d77ce7bdd
    [4e5ecaa84cfeae5bd080b3ed74a4d811] => ae9fd5161fbff5fb6b68517eae3b3d64
    [joomla_user_state] => logged_in
    [Itemid] => 128
    [option] => com_content
    [view] => article
    [id] => 1
    [beobachtungen] => 
)
Array
(
    [validate_fields10] => Array
        (
            [log] => Automatic validation enabled.
            [var] => 1
        )

    [save_data17] => Array
        (
            [data] => Array
                (
                    [datum] => 2019-04-04
                    [teilnehmer] => 
                    [datenweitergabe] => 1
                    [created] => 2019-04-03 21:10:13
                    [user_id] => 909
                    [fundort] => Wandlitz , 
                    [beobachter] => Super User
                    [species] => {"1":"amasina, Rhagades, (Herrich-Schäffer, 1851)"}
                    [anzahl] => {"1":""}
                    [stadium] => {"1":"Imago"}
                    [geschlecht] => {"1":"männl"}
                    [beobachtung] => {"1":"Am Licht"}
                    [bestimmung] => {"1":"Augenschein"}
                    [bemerkung] => {"1":""}
                    [photo] => {"1":""}
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `mtb_beobachtung_fundort` (`datum`, `teilnehmer`, `datenweitergabe`, `created`, `user_id`, `fundort`, `beobachter`)  values  ('2019-04-04', '', '1', '2019-04-03 21:10:13', '909', 'Wandlitz , ', 'Super User');
                )

            [var] => Array
                (
                    [datum] => 2019-04-04
                    [teilnehmer] => 
                    [datenweitergabe] => 1
                    [created] => 2019-04-03 21:10:13
                    [user_id] => 909
                    [fundort] => Wandlitz , 
                    [beobachter] => Super User
                    [beo_id] => 237
                )

        )

    [save_data30] => Array
        (
            [data] => Array
                (
                    [species] => amasina, Rhagades, (Herrich-Schäffer, 1851)
                    [anzahl] => 
                    [stadium] => Imago
                    [geschlecht] => männl
                    [beobachtung] => Am Licht
                    [bestimmung] => Augenschein
                    [bemerkung] => 
                    [photo] => 
                    [created] => 2019-04-03 21:10:13
                    [user_id] => 909
                    [beo_id] => 237
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `mtb_beobachtung` (`species`, `anzahl`, `stadium`, `geschlecht`, `beobachtung`, `bestimmung`, `bemerkung`, `photo`, `created`, `user_id`)  values  ('amasina, Rhagades, (Herrich-Schäffer, 1851)', '', 'Imago', 'männl', 'Am Licht', 'Augenschein', '', '', '2019-04-03 21:10:13', '909');
                )

            [var] => Array
                (
                    [species] => amasina, Rhagades, (Herrich-Schäffer, 1851)
                    [anzahl] => 
                    [stadium] => Imago
                    [geschlecht] => männl
                    [beobachtung] => Am Licht
                    [bestimmung] => Augenschein
                    [bemerkung] => 
                    [photo] => 
                    [created] => 2019-04-03 21:10:13
                    [user_id] => 909
                    [beof_id] => 51
                )

        )

)
Fredolino 03 Apr, 2019
Double Post IE is stupid ...
healyhatman 03 Apr, 2019
Does your first table have an Auto Incrementing primary key for an ID?
Fredolino 04 Apr, 2019
Hi,

yes a primary key and this structure:
Tablename: mtb_beobachtung_fundort
beo_id / int (11) / unsigned / null: no / default: none / auto_increment

Tablename for repeater data:
mtb_beobachtung
beof_id with primary key and auto_increment
col_2
beo_id (with index key "idx_beo_id", Type: BTREE, no unique
int (11) / null: no / default: none /
col_4
...
healyhatman 04 Apr, 2019
OK so in your SECOND save data action, save your foreign key as
beo_id:{var:save_data#.beo_id}

Where # is replaced by the correct number from your FIRST save data action.
Fredolino 04 Apr, 2019
Yes :-)
i have this:
{var:save_data17.beo_id}

It funktiniert.
It is me but only the first record from the repeater in the 2nd table stored although I, for example. Want to add 2 records.

LG
F.
healyhatman 04 Apr, 2019
What are your fields called? Because they should be in the form
group[{var:area_repeater#.key}][fieldname]
Fredolino 04 Apr, 2019
I have in it (see screen)

​[file=11913]screen.jpg[/file]
​[file=11914]screen1.jpg[/file]
healyhatman 04 Apr, 2019
OK so the save data action for the repeater area stuff should be in a loop event, data source {data:Model}, with data override on insert for each field in the form
databasefieldname:{var:loop_event#.row.field}
Fredolino 05 Apr, 2019
[div tabindex="0"]do you mean that maybe?[file=11929]Screenshot_2019.png[/file]
healyhatman 05 Apr, 2019
You're missing a t in your data provider and override fields. loop_event31
Fredolino 05 Apr, 2019
OK
2 different data sets are selected in the repeater
but he still saves me the first record.
Array
(
    [chronoform] => beobachtungen
    [event] => submit
    [Fund] => Array
        (
            [datum] => 2019-04-12
            [teilnehmer] => 
            [datenweitergabe] => 1
        )

    [Data25] => Array
        (
            [fundort] => Wandlitz , 
        )

    [Data26] => Array
        (
            [beobachter] => Super User
        )

    [group] => Array
        (
            [1] => Array
                (
                    [species] => pruni, Rhagades, (Denis & Schiffermüller, 1775)
                    [anzahl] => 
                    [stadium] => Imago
                    [geschlecht] => männl
                    [beobachtung] => Am Licht
                    [bestimmung] => Augenschein
                    [bemerkung] => 
                    [photo] => 
                )

            [2] => Array
                (
                    [species] => volgensis, Jordanita, (Möschler, 1862)
                    [anzahl] => 
                    [stadium] => Imago
                    [geschlecht] => männl
                    [beobachtung] => Am Licht
                    [bestimmung] => Augenschein
                    [bemerkung] => 
                    [photo] => 
                )

        )

    [button13] => 
    [8cd96a265a46e007f7cfe1f554be7f0b] => f807b3b773daf7a952735fbecad51215
    [joomla_user_state] => logged_in
    [4e5ecaa84cfeae5bd080b3ed74a4d811] => 4a849e04d7d91d3c0aac38c92ff3c114
    [Itemid] => 128
    [option] => com_content
    [view] => article
    [id] => 1
    [beobachtungen] => 
)
Array
(
    [validate_fields10] => Array
        (
            [log] => Automatic validation enabled.
            [var] => 1
        )

    [save_data17] => Array
        (
            [data] => Array
                (
                    [datum] => 2019-04-12
                    [teilnehmer] => 
                    [datenweitergabe] => 1
                    [created] => 2019-04-05 10:15:13
                    [user_id] => 909
                    [fundort] => Wandlitz , 
                    [beobachter] => Super User
                    [species] => {"1":"pruni, Rhagades, (Denis & Schiffermüller, 1775)","2":"volgensis, Jordanita, (Möschler, 1862)"}
                    [anzahl] => {"1":"","2":""}
                    [stadium] => {"1":"Imago","2":"Imago"}
                    [geschlecht] => {"1":"männl","2":"männl"}
                    [beobachtung] => {"1":"Am Licht","2":"Am Licht"}
                    [bestimmung] => {"1":"Augenschein","2":"Augenschein"}
                    [bemerkung] => {"1":"","2":""}
                    [photo] => {"1":"","2":""}
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `mtb_beobachtung_fundort` (`datum`, `teilnehmer`, `datenweitergabe`, `created`, `user_id`, `fundort`, `beobachter`)  values  ('2019-04-12', '', '1', '2019-04-05 10:15:13', '909', 'Wandlitz , ', 'Super User');
                )

            [var] => Array
                (
                    [datum] => 2019-04-12
                    [teilnehmer] => 
                    [datenweitergabe] => 1
                    [created] => 2019-04-05 10:15:13
                    [user_id] => 909
                    [fundort] => Wandlitz , 
                    [beobachter] => Super User
                    [beo_id] => 264
                )

        )

    [save_data30] => Array
        (
            [data] => Array
                (
                    [species] => pruni, Rhagades, (Denis & Schiffermüller, 1775)
                    [anzahl] => 
                    [stadium] => Imago
                    [geschlecht] => männl
                    [beobachtung] => Am Licht
                    [bestimmung] => Augenschein
                    [bemerkung] => 
                    [photo] => 
                    [created] => 2019-04-05 10:15:13
                    [user_id] => 909
                    [beo_id] => 264
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `mtb_beobachtung` (`species`, `anzahl`, `stadium`, `geschlecht`, `beobachtung`, `bestimmung`, `bemerkung`, `photo`, `created`, `user_id`, `beo_id`)  values  ('pruni, Rhagades, (Denis & Schiffermüller, 1775)', '', 'Imago', 'männl', 'Am Licht', 'Augenschein', '', '', '2019-04-05 10:15:13', '909', '264');
                )

            [var] => Array
                (
                    [species] => pruni, Rhagades, (Denis & Schiffermüller, 1775)
                    [anzahl] => 
                    [stadium] => Imago
                    [geschlecht] => männl
                    [beobachtung] => Am Licht
                    [bestimmung] => Augenschein
                    [bemerkung] => 
                    [photo] => 
                    [created] => 2019-04-05 10:15:13
                    [user_id] => 909
                    [beo_id] => 264
                    [beof_id] => 70
                )

        )

)
[file=11941]Firefox_Screenshot_2019-04-05T10-28-00.007Z.png[/file]
healyhatman 05 Apr, 2019
You've put a "1" in the keys provider of your loop event, why? That tells the loop to only run on the second (index 1) entry in the array.
Fredolino 05 Apr, 2019
Hi,

under design
in area_repeater2:
Data provider: 1
Keys provider (optional): 1 (if empty, the record starts with "0" in the frontend)


under Setup
in loop_event31:
Data provider: {data: group}
Keys provider (optional): empty

I'm still only saved one record ...
healyhatman 05 Apr, 2019
So you've looked in your database and only one field is being saved? Can you put in a custom code block in your loop event, with

{var.pr:loop_event#.row}<br>
in it? replacing loop_event# with the correct name and number of your loop event.
Fredolino 05 Apr, 2019
this is a exemple[file=11949]screen1.jpg[/file]
​[file=11950]screen2.jpg[/file]
healyhatman 05 Apr, 2019
1) Your database table has all the required fields in it, right?
2) In the save data action in the loop, add each field manually to the "data override" settings. The value should be of the form {var:loop_event#.row.fieldname}
3) Make sure Auto Save Fields and Auto Manage are turned off
4) I'm really sick and it's almost midnight so I'm going to bed.
Fredolino 05 Apr, 2019
oh...ok....

​[file=11951]screen3.jpg[/file]
Fredolino 04 May, 2019
Hi,

it just does not want to work with the loop. I'm only saved the first record. Maybe someone has an idea what it is?
Array
(
[chronoform] => beobachtungen
[event] => submit
[Data25] => Array
(
[datum] => 2019-05-31
[fundort] => Ladeburg Schwanensee, Barnim
)

[Data26] => Array
(
[beobachter] => Super User
)

[Fund] => Array
(
[teilnehmer] =>
[datenweitergabe] => 1
)

[group] => Array
(
[1] => Array
(
[species] => pruni, Rhagades, (Denis & Schiffermüller, 1775)
[anzahl] => 1
[stadium] => Imago
[geschlecht] => männl
[beobachtung] => Am Licht
[bestimmung] => Augenschein
[bemerkung] =>
[photo] =>
)

[2] => Array
(
[species] => amasina, Rhagades, (Herrich-Schäffer, 1851)
[anzahl] => 1
[stadium] => Imago
[geschlecht] => männl
[beobachtung] => Am Licht
[bestimmung] => Augenschein
[bemerkung] =>
[photo] =>
)

)

[button13] =>
[4e5ecaa84cfeae5bd080b3ed74a4d811] => 46da41dfde096ee866aab02e1584b462
[8cd96a265a46e007f7cfe1f554be7f0b] => f07c02c45a758c5956f18218eeec1b78
[joomla_user_state] => logged_in
[Itemid] => 128
[option] => com_content
[view] => article
[id] => 1
[beobachtungen] =>
)
Array
(
[validate_fields10] => Array
(
[log] => Automatic validation enabled.
[var] => 1
)

[save_data17] => Array
(
[data] => Array
(
[teilnehmer] =>
[datenweitergabe] => 1
[created] => 2019-05-04 17:03:33
[user_id] => 910
[datum] => 2019-05-31
[fundort] => Ladeburg Schwanensee, Barnim
[beobachter] => Super User
[species] => {"1":"pruni, Rhagades, (Denis & Schiffermüller, 1775)","2":"amasina, Rhagades, (Herrich-Schäffer, 1851)"}
[anzahl] => {"1":"1","2":"1"}
[stadium] => {"1":"Imago","2":"Imago"}
[geschlecht] => {"1":"männl","2":"männl"}
[beobachtung] => {"1":"Am Licht","2":"Am Licht"}
[bestimmung] => {"1":"Augenschein","2":"Augenschein"}
[bemerkung] => {"1":"","2":""}
[photo] => {"1":"","2":""}
)

[_success] => Data saved successfully
[log] => Array
(
[0] => INSERT INTO `mtb_beobachtung_fundort` (`teilnehmer`, `datenweitergabe`, `created`, `user_id`, `datum`, `fundort`, `beobachter`) values ('', '1', '2019-05-04 17:03:33', '910', '2019-05-31', 'Ladeburg Schwanensee, Barnim', 'Super User');
)

[var] => Array
(
[teilnehmer] =>
[datenweitergabe] => 1
[created] => 2019-05-04 17:03:33
[user_id] => 910
[datum] => 2019-05-31
[fundort] => Ladeburg Schwanensee, Barnim
[beobachter] => Super User
[beo_id] => 473
)

)

[save_data30] => Array
(
[data] => Array
(
[species] => pruni, Rhagades, (Denis & Schiffermüller, 1775)
[anzahl] => 1
[stadium] => Imago
[geschlecht] => männl
[beobachtung] => Am Licht
[bestimmung] => Augenschein
[bemerkung] =>
[photo] =>
[created] => 2019-05-04 17:03:33
[user_id] => 910
[beo_id] => 473
)

[_success] => Data saved successfully
[log] => Array
(
[0] => INSERT INTO `mtb_beobachtung` (`species`, `anzahl`, `stadium`, `geschlecht`, `beobachtung`, `bestimmung`, `bemerkung`, `photo`, `created`, `user_id`, `beo_id`) values ('pruni, Rhagades, (Denis & Schiffermüller, 1775)', '1', 'Imago', 'männl', 'Am Licht', 'Augenschein', '', '', '2019-05-04 17:03:33', '910', '473');
)

[var] => Array
(
[species] => pruni, Rhagades, (Denis & Schiffermüller, 1775)
[anzahl] => 1
[stadium] => Imago
[geschlecht] => männl
[beobachtung] => Am Licht
[bestimmung] => Augenschein
[bemerkung] =>
[photo] =>
[created] => 2019-05-04 17:03:33
[user_id] => 910
[beo_id] => 473
[beof_id] => 178
)

)

)
healyhatman 05 May, 2019
Show me a screenshot of your save data action, the one inside the loop, and a screenshot of your loop settings.
Fredolino 05 May, 2019
Hi,

Many thanks for your help.
Here are the screenshots.
In the repeater area (screen1.jpg) I have
Data provider: 1
Key provider: 1

If I leave the key provider field empty, then I have an incorrect number in the frontend (see Screen6.jpg).
If I have "1" in the key provider field, the count starts correctly and there is only one repeater input area open (see Screen7.jpg).


​[file=12164]screen1.jpg[/file]
​[file=12165]screen2.jpg[/file]
​[file=12166]screen3.jpg[/file]
​[file=12167]screen4.jpg[/file]
​[file=12168]screen5.jpg[/file]
​[file=12169]screen6.jpg[/file]
​[file=12170]screen7.jpg[/file]
healyhatman 05 May, 2019
It's not "incorrect" exactly, arrays start at 0.

What's the file upload doing? Put an error message before the event load in the FAIL event I think you'll find it's breaking there.
Fredolino 05 May, 2019
Hi,
even if I remove the "1", then leave the field blank, then only the first record is saved to me.
And in the frontend, the list must begin with "Art 1", as in screen7.jpg
The FileUpload is not required. If it is empty, should not there be any problems?
healyhatman 05 May, 2019
What are your fields called inside your repeater area?
Fredolino 05 May, 2019
z.B
Name: group[{var:area_repeater2.key}][species]
ID: species_{var:area_repeater2.key}
healyhatman 05 May, 2019
Can you PM me access details I've had quite enough of this back and forth guessing 🙂
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger