cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syam
Level: Powered On

ClearCollect function skip the "{Attachment}" column

Hi

I am using a sharepoint list (e.g. "Main List") with "{Attachment}" column to store some images associated to the list item. I also has another list (e.g. "Child List") which has multiple list items mapped to one single list item in "Main List". 

 

In my App design, I followed the same:

1. connect to the SharePoint lists as datasources

2. create a local datasource (using  "ClearCollect")

      

ClearCollect(MergedList, AddColumns('Main List', "Requested", If(CountIf('Child List', And(MainListID = 'Main List'[@ID], Requested_x0020_By_x0020_Email = User().Email)) > 0, "Y", "N")))

 3. Inserted a Gallary controll (Gallery1) and bind the "MergedList" as datasoure.

 4. In Screen 2 - I added another Gallery control and set "Items" = Gallery1.selected.{Attachment}

 

But, the MergedList doesnot have the "{Attachment}" column. It has only "{HasAttachment}". But if I bind the "Main List" to the "Gallery1", then the "Gallery1.selected.{Attachment}" column displayed.

Purpose is, I want to use the "{Attachment}" columns to show the images in a "BrowserGallery".

 

I have to merge the Lists to use the column "Requested" in the screen1 - Gallery1 control.

 

Am I missing any step? Please help me.

TIA - Syam

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft Employee

Re: ClearCollect function skip the "{Attachment}" column

I'm sorry for late reply.

My suggestion was to use a hidden gallery as a storage for sharepoint items (as opposed to MergeList). Instead of conditionally adding columns, you could filter the content of that gallery so it has only the items you need. You could then access those items as Gallery_hidden.AllItmes. The reason for using the hidden gallery is that you should be able to access the Attachemnts items this way.

I hope this helps.

6 REPLIES 6
Microsoft Employee

Re: ClearCollect function skip the "{Attachment}" column

Hello Syam,

 

I think the confusion is that Attachemnts is not a column in a list but rather belongs to a row. For example, if you have a list with one column ans 10 rows, you will have 10 attachments (not 1). This is why you see it on a record level (Gallery.Selected). 

Syam
Level: Powered On

Re: ClearCollect function skip the "{Attachment}" column

Hi

I mean at row (list item) level. I issue is, 

when i bind the "MergedList" (which is created using the "ClearCollect"), there is NO "{Attachments}" field in each item.

But if i bind the list "Main List" directly to the Gallery, then i can read the "{Attachments}" within the Gallery.Selected.

 

I am refering again at Item level. 

In summary, the "ClearCollect" doesnot add the "{Attachments}" field to the collection.

 

Thanks 

Syam

Microsoft Employee

Re: ClearCollect function skip the "{Attachment}" column

Thanks for clarifying. This is actually by design, since Attachments is not a field.

This is not an elegant solution, but you could probably bind the list to a hidden table.

Syam
Level: Powered On

Re: ClearCollect function skip the "{Attachment}" column

Hi

could you please give extend some help / direction, how to - "you could probably bind the list to a hidden table".

 

Thanks in advance. All help is appreciated.

Syam

Microsoft Employee

Re: ClearCollect function skip the "{Attachment}" column

I'm sorry for late reply.

My suggestion was to use a hidden gallery as a storage for sharepoint items (as opposed to MergeList). Instead of conditionally adding columns, you could filter the content of that gallery so it has only the items you need. You could then access those items as Gallery_hidden.AllItmes. The reason for using the hidden gallery is that you should be able to access the Attachemnts items this way.

I hope this helps.

Syam
Level: Powered On

Re: ClearCollect function skip the "{Attachment}" column

HI dinusc

Appreciate the idea. I got that worked as below. But the approach i got from your idea:

 

1. in screen #1 - used a gallery and bind the datasource "Merged List"

2. in screen #1 - On Gallery item OnSelect - created a Collection to store the selected item Attchments 

ClearCollect(screens, First(Filter('Main List', ID=Gallery1.Selected.ID)).'{Attachments}')

3. In Screen #2 - created a new Gallery2 and bind the new collection "screens" to Gallery2

4. In Gallery2 - set Image control "Default" = ThisItem.Value

 

Thank you

Syam

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 53 members 4,752 guests
Please welcome our newest community members: