Hi @likitha ,
Could you please share a bit more about your scenario?
Do you want to save Gallery1 items back to your List1, and save nested Gallery2 items back to your List2?
If you want to save Gallery1 items back to your List1, and save nested Gallery2 items back to your List2, I afraid that there is no way to achieve your needs.
Currently, it is an known issue within PowerApps app -- when referencing All Items of a nested Gallery under a parent Gallery in a ForAll function, the nestedGallery.AllItems formula would return empty record.
So the siteDetailsGallery.AllItems formula would return empty record on your side, the nested ForAll formula could not achieve your needs.
As an alternative solution, I think Collection could achieve your needs. I assume that your Gallery1 and Gallery2 are both connected to individual collection (AddressCollection & SiteCollection), is it right? You could consider save your Gallery1 Items and Gallery2 Items into individual collections, the you could apply your ForAll function to these two individual collections.
I have made a test on my side, please consider take a try with the following workaround:
Add a "Save" icon inside your Gallery1, set the OnSelect property to following:
Patch(
AddressCollection,
ThisItem,
{
AddressCountry: AddressCountryTextBox.Text, // replace AddressCountryTextBox with actual Text Input control name in your Gallery1
City: CityTextBox.Text,
State: StateTextBox.Text
}
)
When you made changes to corresponding Address Item within your Gallery1, press above "Save" icon to save the changes back to your AddressCollection.
Add a same "Save" icon inside your nested Gallery (Gallery2), set the OnSelect property to following:
Patch(
SiteCollection,
ThisItem,
{
Address_Country: Gallery1.Selected.AddressCountryTextBox.Text, // relate the Site Item to the corresponding Address Item
SiteName: SiteNameTextBox.Text,
OperationUnit: OperationUnitDropdownBox.Selected.Value,
LanguagePref: LanguagePrefTextBox.Text,
StartDate: StartDatePicker.SelectedDate
}
)
when you made changes to Site Item in your nested Gallery, press the "Save" icon to save the corresponding Site Item back to your SiteCollection.
Note: I assume that you are configuring your Gallery as a Repeating Table
After that, outside the Gallery1, set the OnSelect property of the "Save" button to following:
ForAll( // patch AddressCollection back to your SupplierAddressDetails List
AddressCollection,
Patch(
SupplierAddressDetails,
Defaults(SupplierAddressDetails),
{
Title: AddressCollection[@AddressCountry],
City: AddressCollection[@City]
}
)
);
ForAll( // Patch SiteCollection back to your SupplierAddressSiteDetails List
SiteCollection,
Patch(
SupplierAddressSiteDetails,
Defaults(SupplierAddressSiteDetails),
{
Title: SiteCollection[@LanguagePref],
'Address Country': SiteCollection[@Address_Country]
}
)
)
Note: I assume that the 'Address Country' is a Text type column in your SupplierAddressSiteDetails List, which is used to store the corresponding 'Address Country' value. You set up relationship between your SupplierAddressDetails List and SupplierAddressSiteDetails List through this 'Address Country' Text field.
Please take a try with above solution, check if the issue is solved.
Best regards,