web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Local, Global Variable...
Power Apps
Unanswered

Local, Global Variables and DataTable

(0) ShareShare
ReportReport
Posted on by 111

Hi

 

I'm working on my second powerapps screen and i'm struggling to work out the best way to create/use variables either global or local. I've looked for examples but have not found anything so I thought i'd ask and hopefully someone will point me in the right direction! 😀

So, 1) to create a local variable do I use an hidden label text control? 2) how do i create a global variable not using a button? finally, can i manually populate a DataTable? i.e. not attaching it to database/sharepoint list?

 

Thanks for any help! 👍

dj

I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @Flyingfishnm ,

     

    1\ No. 

     

    2\ If you want to create variables automatically, please try the following ways.

    (1) Use app's OnStart property. Automatically create a variable when the app is opened

    For example: you could use this formula on OnStart property

    Set(Thevar,"Test")

    (2) Use screen's OnVisible property.Automatically create variables when a specific screen is visible.

    For example: you could use this formula on OnVisible property

    Set(Thevar,"Test")

     

    3\ You could create a collection in powerapps.

    For example: Add a button control and set its onselect property to:

    ClearCollect(Col,{Column1:"A",Column2:"B"},{Column1:"C",Column2:"D"})

    v-xiaochen-msft_0-1617759350994.png

     

    Of course, you could also use onstart property or onvisible property instead of button control's onselect property.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

  • Flyingfishnm Profile Picture
    111 on at

    ...thank you so much! 👍 😊

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard