cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Count the number of requests sent

Hi Super users,

I am currently working on making enhancements in my request app.

Is there a way to collect data when the - sent button is clicked.

* The number of requests sent

* The number of requests sent per request creator

 

Should I create a Sharepoint list?

What do you think works better?

 

Thank you in advance!

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
BCLS776
Super User
Super User

From your description, it sounds like you want a count that persists even after the app is closed. So, yes, a Sharepoint List is a good choice for this. You'll want to add a column for UserEmail and a column for ClicksCount. You can decide too if you want to collect these by day (add a Date-type column to the List) or if you only need a total count ever.

 

In the OnSelect of the button, you'll add a bit of code like this:

With({aLookup: LookUp(mySPList, UserEmail = User().Email)},
    Patch(mySPList,
        aLookUp,
        {ClicksCount: aLookup.ClicksCount + 1}
    )
)
    

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

Anonymous
Not applicable

That's clear, thank you.

Now that I cleaned up the string and made sure that the column has the right type. I tested it, no error prompted. However, MySharepoint list remains empty.

It did not record my name as the user and the number of requests I sent. 

 

patch_string.JPG

 

 

 

 

 

 

View solution in original post

10 REPLIES 10
BCLS776
Super User
Super User

From your description, it sounds like you want a count that persists even after the app is closed. So, yes, a Sharepoint List is a good choice for this. You'll want to add a column for UserEmail and a column for ClicksCount. You can decide too if you want to collect these by day (add a Date-type column to the List) or if you only need a total count ever.

 

In the OnSelect of the button, you'll add a bit of code like this:

With({aLookup: LookUp(mySPList, UserEmail = User().Email)},
    Patch(mySPList,
        aLookUp,
        {ClicksCount: aLookup.ClicksCount + 1}
    )
)
    

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.
Anonymous
Not applicable

Thank you Bryan, I tried the solution you sent.

Any idea why I'm getting a squiggly line under the UserEmail 🙄?

 

squiggly_patching.JPG

 

 

 

 

Without seeing the error message itself, my first guess is that UserEmail isn't a column in the 'SENT REQUEST_TRACKER' table. If you have another suitable column in there, please substitute that column name instead.

 

If it is something else, please share the exact error message.

 

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.
Anonymous
Not applicable

Hi Bryan,

I tried modifying the column names and made sure it's added in the code. However, still getting the same error.

The error prompt is "Expected Error. We expect an operator such as +, *, or & at this point in the formula"

 

 

 

 

BCLS776
Super User
Super User

BCLS776_0-1634228344581.png

 

If the column is named User Name (with a space between the words), then the name must be enclosed in single quotes, e.g. 'User Name'. Right now, Power Apps thinks you are referring to two separate columns, one named User and one named Name.


Also, if you are expecting names, and not email addresses, of users in that column, please substitute User().FullName for User().Email in the expression.

_________________________________________________________________________________________
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.
Anonymous
Not applicable

That's clear, thank you.

Now that I cleaned up the string and made sure that the column has the right type. I tested it, no error prompted. However, MySharepoint list remains empty.

It did not record my name as the user and the number of requests I sent. 

 

patch_string.JPG

 

 

 

 

 

 

Anonymous
Not applicable

Now I know what went wrong 😁

Thank you Bryan, your suggestion works!

Anonymous
Not applicable

Hi, Followup question though

1.  Is it possible to reset the count when a new week starts?

 

I'm still trying to figure out the right syntax to show week number instead of date.

 

 


@Anonymous wrote:

Hi, Followup question though

1.  Is it possible to reset the count when a new week starts?

 

I'm still trying to figure out the right syntax to show week number instead of date.

 

 


Yes, you can reset the count once each week. My recommendation is that you do it with a Power Automate flow so it happens each week no matter when you use your app. The friendly folks on the related Power Automate community forum can help you set that up.

 

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

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