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

Community site session details

Session Id : WDni3b8cnVtzAaU9LGZ41d
Power Apps - Building Power Apps
Answered

create a vote with click limit

Like (0) ShareShare
ReportReport
Posted on 24 Jul 2020 01:01:36 by 267

I want use powerapps to development a vote system .

 

I will let my user to chose which period they can to do something , but each period has limit ,maybe 20 people . When the click time reach the limit , the item will become “gray “ and user can not chose it.

 

So how can I finish my job or someone can tell me it has reference paper , thank you very much !!!

  • JACK_LAI_1117 Profile Picture
    267 on 31 Jul 2020 at 01:47:21
    Re: create a vote with click limit

    YUP!!

    Finally , I finish this job today , in your method it can limit the click amount in this app 

     

    @v-bofeng-msft  

    Thank you very much~

  • JACK_LAI_1117 Profile Picture
    267 on 24 Jul 2020 at 07:57:41
    Re: create a vote with click limit

    @v-bofeng-msft 

     

    Thank you very much  ,  maybe next monday  I will try it 

     

    Now I have a template to reference  , YES!!!!

     

  • Verified answer
    v-bofeng-msft Profile Picture
    on 24 Jul 2020 at 05:39:07
    Re: create a vote with click limit

    Hi @JACK_LAI_1117 :

    I think this problem should start from two aspects: data source construction and app construction.

    I assume there are two events for the user to choose: "event1" and "event2".

    • 1\Can a user select two events at the same time?
    • 2\Can a user select the same event multiple times?

    I assume that a user can only select one event at a time, and an event cannot be selected multiple times.

    I'v made a test for your reference:

    1\My data source(TheList-SharePointList):

    Column (click to edit) Type

    TitleSingle line of text
    DisplayNameSingle line of text
    EventSingle line of text

    2\Add two buttons(Event1/Event2)

    Event1

    OnSelect

     

    Patch(TheList,{Title:Text(Now()),DisplayName:User().FullName,Event:"Event1"})

     

    DisplayMode

     

    If(User().FullName in TheList.DisplayName || CountRows(Filter(TheList,Event="Event1"))>=20,Disabled,Edit)

     

    Event2

    OnSelect

     

     

    Patch(TheList,{Title:Text(Now()),DisplayName:User().FullName,Event:"Event2"})

     

     

    DisplayMode

     

     

    If(User().FullName in TheList.DisplayName || CountRows(Filter(TheList,Event="Event2"))>=20,Disabled,Edit)

     

    4.gif

    Best Regards,

    Bof

     

  • mdevaney Profile Picture
    29,987 Moderator on 24 Jul 2020 at 02:55:58
    Re: create a vote with click limit

    @JACK_LAI_1117

    Same idea applies here...

    Use this code in the OnSelect property of the vote button to increase the vote count.

    Set(varPatchRecord, LookUp(your_datasource_name, ID=ThisItem.ID));
    Patch(your_datasource_name, varPatchRecord, {NumberOfPeople: varPatchRecord.NumberOfPeople + 1});


    Put this code in the DisplayMode property of the vote button.  It will disable voting after 20 people have voted.

    If(ThisItem.NumberOfPeople >= 20, DisplayMode.Disabled, DisplayMode.Edit) 

     


    My example assumes the vote button is inside a gallery or a form and there is a datasource with a column called NumberOfPeople storing the votes total.

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • JACK_LAI_1117 Profile Picture
    267 on 24 Jul 2020 at 02:25:12
    Re: create a vote with click limit

    @mdevaney 

     

    NO , I mean 20 person , because my meeting room has it's capacity , so in order to prevent too many person chose the same time , son I need to set up this condition ~~~

  • mdevaney Profile Picture
    29,987 Moderator on 24 Jul 2020 at 01:39:21
    Re: create a vote with click limit

    @JACK_LAI_1117 
    20 people is not a unit of measure for time.  I will assume you meant to say: 20 minutes.

     

    Put this code in the DisplayMode property of the vote button.  It will disable voting after 20 minutes

    If(Now() > DateAdd(ThisItem.Created, 20, Minutes), DisplayMode.Disabled, DisplayMode.Edit) 

     

    I assume the vote button is inside of a Form.  Therefore I used the ThisItem operator.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2