cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shettyshashank1
Frequent Visitor

Attachment file duplicates when submitting vis Powerapps with Dataverse backend

HI All,

 

I have a canvas PowerApps with Dataverse as backend. I attached a file and added data in Canvas Powerapps and submitted. The data and Attachement got successfully submitted to Table in Dataverse. But when i again retrieved the submitted record via Gallery in Powerapps and updated data and resubmitted,the data updates was successfully submitted. But when i retrieve the record in Powerapps gallery, i  find that attached file submitted in the first instance has duplicated. Can you please let me know if there is any settings that i need to change such that attached file does not get duplicated whenever i re-submit the same record.

 

Thanks for your help!

Shashank

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @shettyshashank1 ,

 

You could try this formula on your attachment data card' s Default property of display form control.

ForAll(Distinct(ThisItem.Attachments,DisplayName),LookUp(ThisItem.Attachments,DisplayName=Result))

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

8 REPLIES 8
v-xiaochen-msft
Community Support
Community Support

Hi @shettyshashank1 ,

 

Could you tell me:

Are other attachments automatically added when the record is modified?

 

If so ,this is a strange problem.

 

I did not encounter similar problem. Please see the picture below.

1\ Insert a label control into gallery control and set its Text property to:

CountRows( ThisItem.Attachments)

 

2\ This is my record before modification. Now it has an attachment.

v-xiaochen-msft_0-1613357447069.png

3\ Select the record and modify its 'Name' column and save it.

v-xiaochen-msft_1-1613357473943.png

v-xiaochen-msft_2-1613357558280.png

 

4\ The result is as follows:

v-xiaochen-msft_3-1613357581791.png

v-xiaochen-msft_4-1613357593197.png

 

If you have any problems, please provide specific formulas.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

 

Apologies for my delayed response and appreciate your reply. I may have not phrased my issue correctly. 

The attachments are showing to be duplicated only in display mode but not in edit mode.

Please refer below with exact steps leading to my issue with screenshots as below:-

1) I create a new form and add attachment (Pic5.jpg) and submit it.  Please refer attached screenshot1 file before submitting the form.

2) The form gets submitted successfully. When I click on the submitted form in gallery and view it in display mode. I can view the file attached. I edit the form and update a field and again submit without attaching any new file. The form gets submitted again successfully.

3) when I again go to gallery and click on submitted form to view the form in display mode, I can see two same file names as per attached screenshot2 file.

4) But when I go into edit mode, I can only see one file.

 

So this issue of duplication of files only happens in display mode. Please let me know if you want me to try anything to resolve this issue.

 

thanks

v-xiaochen-msft
Community Support
Community Support

Hi @shettyshashank1 ,

 

This is a strange problem.

 

Could you tell me:

If you can see two attachments in the view display mode, how many attachments do you actually have?(one or two?)

Could you provide specific formulas?

 

Best Regards,
Wearsky

 

HI @v-xiaochen-msft ,

 

I only have one attachment. I am just using the default attachment option of dataverse. i haven't edited or modified any formulas related to attachment.  The formula for attachment in displaymode is just Parent.Default.

 

thanks

Shashank

v-xiaochen-msft
Community Support
Community Support

Hi @shettyshashank1 ,

 

You could try this formula on your attachment data card' s Default property of display form control.

First(ThisItem.Attachments)

v-xiaochen-msft_0-1614059113459.png

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

HI @v-xiaochen-msft ,

The above will only help if i attach only 1 file as attachment initially.

 

But if i attach two different files initially while submitting and in display , i can view 4 files in display mode which is  2 each of each file.  I should be able to view both files.  If i go with First(ThisItem.Attachments), then i can only view only one file. Please refer for below example

 

 

1) I attach file1.jpg and file2.jpg initially while submitting. 

 

2) After submission, when i retrieve the the item, i can view file1.jpg and file2.jpg in display mode which is as expected.

 

3) I modify a field and submit the form again. When i again retrieve the item in display mode, i actually view 4 files now which are file1.jpg, file1.jpg, file2.jpg, file2.jpg

 

4) if i change the formula to First(ThisItem.Attachments), i can only view file1.jpg in display mode. 

I should be able to see file1.jpg and file2.jpg which is not happening at the moment.

 

Please let me know if you want me to try anything else.

 

thanks

Shashank

 

v-xiaochen-msft
Community Support
Community Support

Hi @shettyshashank1 ,

 

You could try this formula on your attachment data card' s Default property of display form control.

ForAll(Distinct(ThisItem.Attachments,DisplayName),LookUp(ThisItem.Attachments,DisplayName=Result))

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

shettyshashank1
Frequent Visitor

Thanks @v-xiaochen-msft , It Worked. Thanks for your help !

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,801)