cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sazziukjay
Frequent Visitor

Counting new rows created

Hi,

 

I wanted to visually show an increase/decrease to a number week on week, by making something like the below:

Sazziukjay_0-1630935803125.png

 

Currently these numbers are generated by counting the number of rows in a certain column of a sharepoint list.

 

- I wondered if i could do this easily by counting the number of new records/rows created within the last X days and setting the visible properties to reflect that (eg if >0 then up arrow shows, if <0 (eg row deleted), down arrow shows). Is this possible? I thought I might be able to use the 'created date' auto generated by Sharepoint as the column to show if within the last x days or not?

 

Or is there a better way/not possible at all!

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

No problem at all. First, bookmark this link to Power Apps documentation - you will refer to this again and again.

 

In the OnVisible of your screen, you can put a value into that variable using this code:

If(Value(TextboxA.Text) >= 0,
    UpdateContext({varUp:true}),
    UpdateContext({varUp:false})
)

Note that code will only run as your app navigates to that screen. If that doesn't fit your app's logic, then find another property on a control/button that starts with "On" (these are behavior formulas) and put this code into it.

 

Also, the varUp variable is being used as a context variable here, so it is accessible only on the screen on which it is created. If you need to access this variable on more than one screen, use the Set() function instead of UpdateContext.

 

Hope that helps,

Bryan

 

_________________________________________________________________________________________
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.

View solution in original post

4 REPLIES 4
BCLS776
Super User
Super User

You're on the right track here - control the visibility of those "up" and "down" arrows using app logic. I recommend using variables in those properties (e.g. varUp in one and !varUp in the other) and using Set() or UpdateContext() on those variables in a behavior field of your app such as OnVisible for the screen.

 

A CountRows() on a Filter() by specified dates of your Sharepoint list can be used to fill in your numerical values. You can use the Today() function with DateAdd() to craft the Filter expressions to fit the last seven days or whatever you need.

 

Hope that helps,

Bryan

_________________________________________________________________________________________
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.
Sazziukjay
Frequent Visitor

Thanks @BCLS776 , I've got the date filter working, but i'm struggling with the variables (I've only be using powerapps for a couple weeks so lots of learning!)

 

I'm not sure how to set the UpdateContext bit in the OnVisible screen - I'm guessing it will need to have more logic so like if TextboxA has a value >=0 then VarUp = true, but not sure how to write this? Any suggestions or places i can go for more information?

 

Thanks again for your help!

No problem at all. First, bookmark this link to Power Apps documentation - you will refer to this again and again.

 

In the OnVisible of your screen, you can put a value into that variable using this code:

If(Value(TextboxA.Text) >= 0,
    UpdateContext({varUp:true}),
    UpdateContext({varUp:false})
)

Note that code will only run as your app navigates to that screen. If that doesn't fit your app's logic, then find another property on a control/button that starts with "On" (these are behavior formulas) and put this code into it.

 

Also, the varUp variable is being used as a context variable here, so it is accessible only on the screen on which it is created. If you need to access this variable on more than one screen, use the Set() function instead of UpdateContext.

 

Hope that helps,

Bryan

 

_________________________________________________________________________________________
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.
Sazziukjay
Frequent Visitor

Thank you @BCLS776 , that worked really well!

 

Much appreciated!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,760)