Let's say I have two lists:
-Projects
-Project Employees.
In the Projects list, I have the following columns: UID, Name, Project Number;
In the Project Employees I have the following columns: UID, Project_UID, Employee Name, Start Date, End Date.
- UID - is the primary list unique ID.
- Project_UID is a look up field for the "Projects" list UID field. It's set up as an index with cascade delete.
Now, I'm trying to understand what would be the controls that would allow me to create an "Add" button that would continuously add a new "row/section" for me to type the new employee details (child) for this list. When clicking on the add button, the form/card should extend or create a new employee section to allow adding as many employee rows I would like.
Check out this video at 7:11 mark to understand what I mean: https://youtu.be/AdAGFR3UIW8?t=431
Can this be achieved with a gallery?
Solved! Go to Solution.
Hi @WorkHard ,
Do you want to add new records to your Project Employees list continuously through the "Add" button?
Based on the needs that you mentioned, I think the Gallery control could achieve your needs. Please check and see if the following video resources could help in your scenario:
https://www.youtube.com/watch?v=xgznk4XlPCo
https://www.youtube.com/watch?v=DylxsXIUyDc
https://www.youtube.com/watch?v=vjfrXUa1Juw
I have made a test on my side, please consider take a try with the following workaround:
Set the OnStart property of App to following:
ClearCollect(GalleryCollection, CountRows(GalleryCollection)+1)
Add a "+" icon in your screen, set the OnSelect property to following:
Collect(GalleryCollection, CountRows(GalleryCollection)+1)
Add a Gallery, set the Items property to following:
GalleryCollection
within the Gallery, add a Text Input, a ComboBox, two Date Pickers and a "Save" icon. And outside the Gallery, add several Labels above the Gallery to act as column headers.
Set the Items property of the Project_UID ComboBox within the Gallery to following:
Choices('Project Employees'.Project_UID)
set the SelectMultiple property of this ComboBox to false.
Set the OnSelect property of the "Save" Icon within the Gallery to following:
Patch(
'Project Employees',
Defaults('Project Employees'),
{
Title: "Entry Record",
'Employee Name': EmployeeNameTex.Text,
Project_UID: ProjectUIDComboBox.Selected,
'Start Date': StartDatePicker.SelectedDate,
'End Date': EndDatePicker.SelectedDate
}
)
Set the OnSelect property of the "Patch All" button to following:
ForAll(
Gallery1.AllItems,
Patch(
'Project Employees',
Defaults('Project Employees'),
{
Title: "Entry Record",
'Employee Name': EmployeeNameTex.Text,
Project_UID: ProjectUIDComboBox.Selected,
'Start Date': StartDatePicker.SelectedDate,
'End Date': EndDatePicker.SelectedDate
}
)
)
Please take a try with above solution, check if the issue is solved.
Patch function, ForAll function
Best regards,
Hi @WorkHard ,
Do you want to add new records to your Project Employees list continuously through the "Add" button?
Based on the needs that you mentioned, I think the Gallery control could achieve your needs. Please check and see if the following video resources could help in your scenario:
https://www.youtube.com/watch?v=xgznk4XlPCo
https://www.youtube.com/watch?v=DylxsXIUyDc
https://www.youtube.com/watch?v=vjfrXUa1Juw
I have made a test on my side, please consider take a try with the following workaround:
Set the OnStart property of App to following:
ClearCollect(GalleryCollection, CountRows(GalleryCollection)+1)
Add a "+" icon in your screen, set the OnSelect property to following:
Collect(GalleryCollection, CountRows(GalleryCollection)+1)
Add a Gallery, set the Items property to following:
GalleryCollection
within the Gallery, add a Text Input, a ComboBox, two Date Pickers and a "Save" icon. And outside the Gallery, add several Labels above the Gallery to act as column headers.
Set the Items property of the Project_UID ComboBox within the Gallery to following:
Choices('Project Employees'.Project_UID)
set the SelectMultiple property of this ComboBox to false.
Set the OnSelect property of the "Save" Icon within the Gallery to following:
Patch(
'Project Employees',
Defaults('Project Employees'),
{
Title: "Entry Record",
'Employee Name': EmployeeNameTex.Text,
Project_UID: ProjectUIDComboBox.Selected,
'Start Date': StartDatePicker.SelectedDate,
'End Date': EndDatePicker.SelectedDate
}
)
Set the OnSelect property of the "Patch All" button to following:
ForAll(
Gallery1.AllItems,
Patch(
'Project Employees',
Defaults('Project Employees'),
{
Title: "Entry Record",
'Employee Name': EmployeeNameTex.Text,
Project_UID: ProjectUIDComboBox.Selected,
'Start Date': StartDatePicker.SelectedDate,
'End Date': EndDatePicker.SelectedDate
}
)
)
Please take a try with above solution, check if the issue is solved.
Patch function, ForAll function
Best regards,
Thank you for this very detailed response!
I just have one more thing that I need to wrap my head around:
For the master list (Project List), I still want to browse directly in Sharepoint. I'm using the Power app only as the view, edit form. Just like in the old sharepoint were the form is the infopath but the viewing aspect is just a sharepoint list.
Now, how do I make the default sharepoint "double click on an item" action to ope the record in power apps form with a collection ready,etc.? Or the "New" button in the sharepoint list?
I can't just add this to the screen OnLoad funtion because the logic is different depending on if the record is new or in edit mode.
It sounds like this solution would only work if you go Full Power Apps and don't use the SharePoint interface at all.
User | Count |
---|---|
184 | |
124 | |
89 | |
45 | |
43 |
User | Count |
---|---|
261 | |
160 | |
128 | |
81 | |
73 |