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

Filtering Items in Attachments with Name

So in my case, I'm creating an application with two data cards with attachments

Attachment Name - "HardwareGoods" and 

another Attachment Name - "Invoice"

OnAddFile - 

 

Clear(CollectingIncorrectNames);
ForAll(
Self.Attachments.Name,
If(
Not("HardwareGoods" in Name),
Collect(
CollectingIncorrectNames,{Name : Name}
));
If(
CountRows(CollectingIncorrectNames)>0,
Notify("Change Attachment Name to 'HardwareGoods' on the file name", Error); Reset(Self))

On Items - How do I filter only Attachments which has a name with 'HardwareGoods' only not the 'invoice'

1 ACCEPTED SOLUTION

Accepted Solutions
Rhk
Helper II
Helper II

@WarrenBelz Thanks for your help. A few lines of code did work from your responses but got a better visual solution from this video -

https://www.youtube.com/watch?v=hJQjGE-oUpM

View solution in original post

5 REPLIES 5
Rhk
Helper II
Helper II

@WarrenBelz Can you help me with this

WarrenBelz
Super User
Super User

Hi @Rhk ,

Two things - this will sort the first one out OnAddFile

If(
    !("HardwareGoods" in Last(Self.Attachments).Name),
    Notify(
        "Change Attachment Name to 'HardwareGoods' on the file name",
        Error
    );
    Reset(Self)
)

However, if your two attachment controls are on the one Form, the second one submitted (in the order they are on the form) will overwrite the first one, so you cannot save two sets in one SubmitForm)

 

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.

Visit my blog Practical Power Apps

On Items Property - How do I filter Attachments which has a name with 'HardwareGoods' but not the 'invoice'

Hi @Rhk ,

I am not sure of the other consequences of this when saving, but you can display only HardwareGoods in the Attachment Control Items with

Filter(
   ThisItem.Attachments,
   "HardwareGoods" in DisplayName
)

 

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.

Visit my blog Practical Power Apps

 

Rhk
Helper II
Helper II

@WarrenBelz Thanks for your help. A few lines of code did work from your responses but got a better visual solution from this video -

https://www.youtube.com/watch?v=hJQjGE-oUpM

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (3,212)