Good morning everyone!
I have 5 SharePoint list called Apple,Banana,Cat,Dog,Egg.
Apple structure: Title, Foreman, Labour Banana structure: Title, Foreman, Labour Cat structure: Title, Foreman, Labour Dog structure: Title, Foreman, Labour Egg structure: Zone, Title, Foreman, Labour, Remote Site
I want to press the button to navigate the screen called "BrowseScreen_Archive".
In the "Browse Screen", it has one gallery, i want to combine these 5 SharePoint lists data and shown in the Gallery.
I found on the Internet that it can use ClearCollect to combine multiple SharePoint list as collection on the button.
I tried, it causes error which is "The function 'ClearCollect' has some invalid arguments." and i do not know to fix and how to set the Items in Gallery.
Button OnSelect Code:
ClearCollect(AllArchive,'Apple','Banana','Cat','Dog','Egg');
Navigate(BrowseScreen_Archive,ScreenTransition.UnCover);
Would anyone can help me? Thank you very much.
If the schema of the lists that you are trying to collect are exactly the same as each other, then your expression should work. But since there seems to be some differences, you can use the ShowColumns or ForAll function to "map" the lists into what you want, something similar to the logic below:
ClearCollect(
AllArchive,
ShowColumns(Apple, Title, Foreman, Labour),
ShowColumns(Banana, Title, Foreman, Labour),
ShowColumns(Cat, Title, Foreman, Labour),
ShowColumns(Dog, Title, Foreman, Labour),
ShowColumns(Egg, Title, Foreman, Labour, Zone, 'Remote Site')
)
Or using ForAll:
ClearCollect(
AllArchive,
ForAll(
Apple,
{ Title: Title, Foreman: Foreman, Labour: Labour }),
ForAll(
Banana,
{ Title: Title, Foreman: Foreman, Labour: Labour }),
ForAll(
Cat,
{ Title: Title, Foreman: Foreman, Labour: Labour }),
ForAll(
Dog,
{ Title: Title, Foreman: Foreman, Labour: Labour }),
ForAll(
Egg,
{ Title: Title, Foreman: Foreman, Labour: Labour, Zone: Zone, 'Remote Site': 'Remote Site' })
)