Hi everyone
I need dev an app that i can generete various record, associated with only one.
For example, i need to input "title, date, category" and next i need input various "events, image" associated with "title, date, category".
In SQL have two tables. TableHead and TableBody.
The association is one to many.
TableHead:
TableBody:
I already know how to save records in SQL and I think I know how to associate them by generating the same "id_title (key associated)".
But I need to know how to make the power app allow me to add several "event and image" inputs as the user wants.
For example, a "+" button that adds new "event and image" fields that, when saved, are associated with the same tableHead table record.
".
Hi @gabrielv22 ,
Do you want to add multiple "event and image" fields via a "+" button, and saved with same tableHead table record?
Based on the needs that you mentioned, I think the Gallery control could achieve your needs. You could consider add a Gallery control within your app, and configure it as a Editable grid.
I think the repeating table sample app provided by @Shane Young would help in your scenario, please check the following video resources for more details:
https://www.youtube.com/watch?v=xgznk4XlPCo&t=66s
https://www.youtube.com/watch?v=DylxsXIUyDc&t=8s
https://www.youtube.com/watch?v=HUX_0AA4-Hs&t=1s
On your side, please consider take a try with the following workaround:
Set the OnStart property of the App to following:
ClearCollect(GalleryCollection, 1)
Add a Gallery control (Gallery1) within your app, set the Items property to following:
GalleryCollection
within the Gallery, add a Text Input box (EvenytTextInputBox) and a "Add Picture" control to collect your entry.
Outside this Gallery, add a "+" icon, set the OnSelect property to following:
Collect(GalleryCollection, CountRows(GalleryCollection)+1)
Add a Edit form (Form1) above the Gallery, then connect it to your TableHead SQL Table. Set the DefaultMode property of the Edit form to following:
FormMode.New
set the OnSelect property of the "Submit" button to following:
SubmitForm(Form1)
set the OnSuccess property of the Edit form to following:
ForAll( /* <-- Save multiple records from your Gallery back to your TableBody Table along with same "title, date, category" record */ Gallery1.Allitems, Patch( TableBodyTable,
Defaults(TableBodyTable),
{
id_title: Form1.LastSubmit.id_title,
event: EvenytTextInputBox.Text,
image: UploadedImage1.Image
} ) );
ResetForm(Form1)
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
That worked!
Now, I have a problem with previewing the image.
Repeat the images in the gallery. But only when I am seeing them, because the correct ones are saved in the database.
Here I load the first image:
Here I try to load the second image but I repeat the previous one:
I need you to generate the record in the collection completely empty, with no image.
It also changes the text in the add image box. Change from "change image" (Image1) to "Add image" (Image2), when the image is already loaded.
I use this FX:
Patch(Col_TmpDetalleIns; ThisItem; {observacion: InputObs.Text; accion_tomada: InputAccion.Text; foto: UploadedImage1.Image});;
Collect(Col_TmpDetalleIns; {observacion: ""; accion_tomada: ""; foto: ""})
User | Count |
---|---|
140 | |
133 | |
80 | |
75 | |
74 |
User | Count |
---|---|
210 | |
199 | |
71 | |
66 | |
55 |