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 / Working with variables...
Power Apps
Unanswered

Working with variables in PowerApps

(0) ShareShare
ReportReport
Posted on by 271

My next challange is how to work with variables. For instance. 

 

- Create a Data Source that gets a count of tasks from the database. Let's say I have 10 tasks. 

- Be able to create a text box on the main form that displays 'You have 10 tasks' but the property is really 'You have <variable> tasks' displayed. I know that we're supposed to use ContextVariables I think? But I haven't worked out where to actually 

 

1. Obtain that 'value' from my data source (I can create a data source and use it as the source for a gallery or a chart but not a text box?)

2. WHere to actually write out that I want to pass that value to a variable

3. Structure the text box to include that value/variable (as mentioned, "I have <n> tasks" 

Categories:
I have the same question (0)
  • Verified answer
    AndyPennell Profile Picture
    on at


    Set the Text property to be something like

     

    "I have " & CountRows(datasource) & " tasks"

     

  • Verified answer
    SinanE Profile Picture
    174 on at

    Hi James, you could do something like this:

     

    In the Text property of the text box, enter this:

     

    Concatenate("I have ", Text(CountRows(MyList)), " tasks")

     

    where MyList is your data source name

     

     

  • JamesM Profile Picture
    271 on at

    Hey thanks! Sounds so simple haha. I am frustrated by being so comfortable with C# but such a newbie when it comes to PowerApps! 😕 So your example is good for returning a count of rows as the value, but what if I wanted to get a text value from that data source? E.g. the task name? So the data set was

     

    Tasks

    -------

    Task A

    Task B 

    Task C

     

    I want my text box to display "You've selected: Task B"  (You've selected: <n>")

  • JamesM Profile Picture
    271 on at

    Apologies SinanE I posted my reply before I saw yours. Thank you 🙂 I'll try that out. 

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