Showing results for 
Search instead for 
Did you mean: 
Not applicable

VarDataFrom to get selected data from Gallery data

Hey Community, I used VarFromData in Item at Form Control and get data from gallery data successfully. But I do not understand why does this work, i stole the idea from some videos. I use gallerydata.selected to get selected data, but it has error. I have seen any source to explain VarFromData. It shows green color in the property, is there any document to explain the meaning of different colors of the function in PowerApps? Thanks experts in advance!!!

Super User
Super User

Power Apps will color controls, variables, and other defined terms to help with debugging and visualizing relationships.


Your VarFromData term is likely a variable defined by a Set() or UpdateContext() function. In the Studio, click on View and then Variables to see a list of them used/defined in your app. Click on the one labeled VarFromData and you'll where it shows up in your app.

Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
Not applicable

Thanks sir, I just checked variables and i saw it there. Can we understand it as a reference? But I still confuse when shall i need to use it and what the purpose to use it? Sorry, i am a newbie in Powerapps!


BTW, is there any documents to explain all the color controls - from general sense, I think it will be very help to know the meaning of different colors when I use it more often. Sometimes, I just solved a single problem - but it is willing to deep understand this powerful tool!! Thanks again! 

Here's some info on the syntax colors in Power Apps. It is a handy feature that many code development studio apps use.


A variable is a reference to some data that you can use in your app. You can store and then later retrieve or alter the data to suit the app's purposes. Power Apps uses two main kinds of variables: Global variables that can be used across any screen, and context variables that only exist on the screen on which they are created.


Note, one of the strengths of Power Apps is that you don't have to use a lot of variables; much of the data can be accessed by referring to controls and their properties. For example, Label1.Text will bring along whatever string is stored in Label1's Text property. Another one, Gallery1.Selected, will give access to the currently-selected record from Gallery1. This helps make using controls and data a lot more intuitive.

Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
Not applicable

Your explanation is very clear! PowerApps has made some function for us to retrieve data, but sometimes it does not work. I am not sure they, for instance, Gallerydata.Selected does not work in my scenario ( I assume it is bc my gallerydata item has search and filter, so selected cannot recognize it). Variables seems more powerful to refer to whatever we want to use again. I will do more research on that 2 types of variables - it is useful! In PowerBi, it uses reference query to intro this kind of technique. I do see people use variables in PQ, but i have not used it. It is interesting to different terms they introduce in different tools. Thanks for your patience and great answer!!! 

Helpful resources

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.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,019)