I think I understand my own problem, but I do not have a solution for it:
- I have 2 tables (fragen, abschnitte).
- Table "fragen" has a lookup for the column "abschnitt" of the table "abschnitte".
- I want to duplicate all items from "abschnitte" with the connected items from "fragen"
-> I can duplicate an item from "abschnitte" with your code (thank you again!). With a new value in the column "abschnitt".
-> Now I want to duplicate all the items from "fragen" connected to the duplicated item from "abschnitte". BUT i need to store the new items from "fragen" with the new value of "abschnitt". And power apps always says that i can not use a non-record-value ....
Can you help me?
Duplication of "abschnitte" (works):
Set(varoldabschnitt, Gallery2_4.Selected.Abschnitt);
Set(varnewabschnitt, Text(Concatenate(Gallery2_4.Selected.Abschnitt,Text(varnummerrand))));
Set(varnummerrand, Rand());
Patch(Abschnitte, Defaults(Abschnitte),
{Abschnitt: varnewabschnitt,
AbschnittNr: Text(Last(Filter(Sort(Abschnitte, Value(AbschnittNr)), Checkliste.Checkliste = Gallery2_4.Selected.Checkliste.Checkliste)).AbschnittNr) + 1,
TabName:Gallery2_4.Selected.TabName,
Checkliste: Gallery2_4.Selected.Checkliste,
Beschreibung:Gallery2_4.Selected.Beschreibung,
'Beschreibung immer sichtbar':Gallery2_4.Selected.'Beschreibung immer sichtbar'}
);
Duplication of "fragen" items connected to the old "abschnitt" from "abschnitte" (not working):
Patch(Fragen,
ForAll(Filter(Fragen, varoldabschnitt = Abschnitt.Abschnitt && Checkliste.Checkliste = Gallery2_3.Selected.Checkliste) As stepThrough,
{Bild:stepThrough.Bild,
Type:stepThrough.Type,
Frage:stepThrough.Frage,
Abschnitt: varnewabschnitt
}))
The error: Invalid argument type (table). need a record value.