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

How to create button which adds attachment?

Hello,

 

I have simple idea behind this.

I want to recreate same function which happens whenever you press "Add attachment", as a button.

Is this possible?

 

lukascaplikas_1-1600237206538.png

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @lukascaplikas :

  Do you want to use which camera button to add attachments to the attachments control?

  In theory, this is impossible to achieve. Because the function of Add Attachments is integrated internally, we can not call it directly.I think the only way at the moment is to add one more transparent attachment control over the button to achieve similar functions.Like this:

45.gif

I'v made a test for your reference:

1\Add an edit form

DataSource

List1 /*List1 is my data source*/

Item

First(List1)

2\Copy the attachments control (DataCardValue5) in the from and place its copy(DataCardValue5_1) outside of the from and on the upper layer of the "camera" button

2.JPG

 3\Set DataCardValue5_1's

Color

RGBA(0, 0, 0, 0)

BorderColor

RGBA(0,0,0,0)

Fill

RGBA(255, 255, 255, 0)

In a word, it is to turn it into a transparent color

OnAddFile

Collect(Mycollection,Self.Attachments); /*Mycollection is my custom collection*/
Reset(DataCardValue5_1)

Items(Delete its Items)


 4\Set DataCardValue5's

Items

Filter(Ungroup(Table({Value:Parent.Default},{Value:Mycollection}),"Value"),!IsBlank(Value))

The purpose of this operation is to combine the original Items in the control and the items collected in the copy into a table.

Best Regards,

Bof

View solution in original post

2 REPLIES 2
Resolver III
Resolver III

Hey @lukascaplikas 
The attachments control is slightly different than other controls but you can also interact with it.
Attachments control have:

365CornerDawid_0-1600237938938.png

 

Following properties when you will select it.
Basically you can define what will happen when User is adding, removing or canceling removal of the files.

Hope this help if this is resolving your problem please remember to select the answer as solution so other community Users can find answer quicker^^
Regards
Dawid

 

Community Support
Community Support

Hi @lukascaplikas :

  Do you want to use which camera button to add attachments to the attachments control?

  In theory, this is impossible to achieve. Because the function of Add Attachments is integrated internally, we can not call it directly.I think the only way at the moment is to add one more transparent attachment control over the button to achieve similar functions.Like this:

45.gif

I'v made a test for your reference:

1\Add an edit form

DataSource

List1 /*List1 is my data source*/

Item

First(List1)

2\Copy the attachments control (DataCardValue5) in the from and place its copy(DataCardValue5_1) outside of the from and on the upper layer of the "camera" button

2.JPG

 3\Set DataCardValue5_1's

Color

RGBA(0, 0, 0, 0)

BorderColor

RGBA(0,0,0,0)

Fill

RGBA(255, 255, 255, 0)

In a word, it is to turn it into a transparent color

OnAddFile

Collect(Mycollection,Self.Attachments); /*Mycollection is my custom collection*/
Reset(DataCardValue5_1)

Items(Delete its Items)


 4\Set DataCardValue5's

Items

Filter(Ungroup(Table({Value:Parent.Default},{Value:Mycollection}),"Value"),!IsBlank(Value))

The purpose of this operation is to combine the original Items in the control and the items collected in the copy into a table.

Best Regards,

Bof

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (26,409)