Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Default Attachments in gallery

(0) ShareShare
ReportReport
Posted on by 725

Hi Everyone

So close but not quite

This works

 

Index(ThisItem.Attachments,1).Value

 

But this does not

 

Index(ThisItem.Attachments,ThisItem.AssetAttachIndex).Value

 

 AssetAttachIndex number is no higher than CountRows(ThisItem.Attachments)

AssetAttachIndex is a number column in Sharepoint.

So it kinda works but I am getting a red squiggly line.

 

What I am trying to do is choose which is my default attachment/image in my galley rows.

  • Verified answer
    v-xiaochen-msft Profile Picture
    on at
    Re: Default Attachments in gallery

    Hi @Corissandageri ,

     

    Please try this:

    With({temp:LookUp(LIST302,ID=ThisItem.ID,AssetAttachIndex),temp2:CountRows(LookUp(LIST302,ID=ThisItem.ID).Attachments)}, If(temp<=temp2, Index(ThisItem.Attachments,temp).Value,""))

     

    Best Regards,

    Wearsky

  • R Bakker Profile Picture
    725 on at
    Re: Default Attachments in gallery

    Hi  v-xiaochen-msft

    Thank you for your time.

    Your formula works but but I am still getting notified that the Index function cannot be called on an empty table. I'll have another look at it later.

  • v-xiaochen-msft Profile Picture
    on at
    Re: Default Attachments in gallery

    Hi @Corissandageri ,

     

    There is nothing wrong with the formula.

    Sometimes, there will be bugs when dynamically referencing the sp attachment column.

    Please try this workaround:

    With({temp:LookUp(LIST302,ID=ThisItem.ID,AssetAttachIndex)}, Index(ThisItem.Attachments,temp).Value)

     

    Best Regards,

    Wearsky

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard