cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Attachments: How to count only saved attachments?

Hi there.

 

Some context. I have an attachments box for users to insert files. I have a 'submit' button next to it. When the attachments box has 3 attachments, the submit button will change its DisplayMode from 'View' to 'Edit', and vice versa. There is also a save button, so they can save before they submit. 

 

Here's the predicament: I use a count to check how many attachments there are, which is fine, however the count doesn't consider whether they're saved or not. This leads to an issue where there can be 3 unsaved attachments, and the submit button change to 'Edit', but in reality if they aren't saved nothing will be submitted. 

 

Is there a way to count only SAVED attachments, to save this from occurring? 

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @Alfie_Smith ,

Yes you can get both totals (saved and unsaved) - you just need to reference two different things. For the number in the control use (saved and unsaved)

CountRows(AttachmentControlName.Attachments)

This can be a label anywhere on the form or set into a variable.

For the number saved - a couple of options - put a label in a card somewhere on the relevant form - you can put it in the attachment control and 

CountRows(ThisItem.Attachments)

will get the number currently saved. - you could hide this and set a variable or display it elsewhere referring to it.

If the form is selected from a gallery and the gallery is based directly on the data source (not a collection)

CountRows(GalleryName.Selected.Attachments)

again you could set a variable on this.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

1 REPLY 1
Super User III
Super User III

Hi @Alfie_Smith ,

Yes you can get both totals (saved and unsaved) - you just need to reference two different things. For the number in the control use (saved and unsaved)

CountRows(AttachmentControlName.Attachments)

This can be a label anywhere on the form or set into a variable.

For the number saved - a couple of options - put a label in a card somewhere on the relevant form - you can put it in the attachment control and 

CountRows(ThisItem.Attachments)

will get the number currently saved. - you could hide this and set a variable or display it elsewhere referring to it.

If the form is selected from a gallery and the gallery is based directly on the data source (not a collection)

CountRows(GalleryName.Selected.Attachments)

again you could set a variable on this.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

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