Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Patching table in Variable

(0) ShareShare
ReportReport
Posted on by 101

Hello i m building my own component in powerapps, since i cannot use in components "collect" command i have decided to try placing table in to variable like this: 

Set(Var_LOV,Table({ID:1,Text:""},{ID:2,Text:""}))

 

afther that i tried to Patch this table like this: 

Ondrix_0-1666176407392.png


Is it possible to add empty row to table in variable like in collection?

Or is there some work around? I want just to press button and with each press of button to add a new row in to that table.

  • Ondrix Profile Picture
    101 on at
    Re: Patching table in Variable

    Thank you, now i understand better that collection cant be inside of component as its part because it is still part of app not component, but i can reach to that collection from component and change that collection in app from that component. It makes sense its retired feature it behaves differently than with variables.

  • Verified answer
    v-xiaochen-msft Profile Picture
    on at
    Re: Patching table in Variable

    Hi @Ondrix ,

     

    Do you want to use the app's collection in the component?

    If my assumption is correct, please turn on the " Collection assess in component scope" Setting.

    After enabling it, please save and restart the app to use it.

    vxiaochenmsft_0-1666258736704.png

    Once enabled, create a collection in the app.

     

    ClearCollect(CollectX,{ID:"1",Text:""},{ID:"2",Text:""})

     

    vxiaochenmsft_1-1666258767626.png

     

    vxiaochenmsft_2-1666258776023.png

     

    Add a Button in the component and set 'OnSelect' attribute to the following formula:

     

    Set(N,N+1);Patch(CollectX,Defaults(CollectX),{ID:2+N,Text:""})

     

     

    vxiaochenmsft_3-1666258830221.png

    vxiaochenmsft_4-1666258838838.png

     

    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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard