Hi! I have created an voting app, with an ac...

Peter_Westin
Participant III

Hi!

I have created an voting app, with an action that adds votes on registrered ideas.

I like to be able to restrict the voting by only 1 vote/day per user.

Does anybody have a solution for that?

Peter

0 4 748
4 REPLIES 4

Hi @Peter_Westin, Presuming that you have a table just to collect votes for various ideas, the expression can be as follows

Assuming you have a

table named say VoteTest to collect votes with columns such as

A) [Idea Name] say enum type column or with drop down reference from other table to allow user to select an idea among many options.

B)[VoteDate] to capture date of voting with initial value as Today() , This field can be hidden if need be.

3)[Voter Email]with initial value as USEREMAIL(). This field also can be hidden if need be.

C)[Upvote] : An Enum type column with with just 1 Enum value of say โ€œYesโ€ for allowing user to Upvote the idea.

D) A primary Key column with UNIQUEID() as initial value. This column too can be hidden.

Please have an expression in valid_if constraint of the field [Upvote} as follows

=

COUNT(SELECT(VoteTest[Voter Email],AND([VoteDate]=Today(),[Voter Email]=USEREMAIL(),[Upvote]=โ€œYesโ€,[Idea Name]=[_THISROW].[Idea Name])))=0

Hope this or a slight variation as per your needs will help you.

@Suvrutt_Gurjar the problem in here is Peter needs to update the existing record (Idea) with the action button where we canโ€™t read the history who has voted and when.

Hi @Aleksi_Alkio, Thank you for your valuable guidance as always. I am sorry that I

missed out on the action part. My suggestion was based on [Upvote] column being an Enum type column and a separate table being needed for keeping track of votes.

@Suvrutt_Gurjar Yeap, thatโ€™s correct. Additional related table is needed.

Top Labels in this Space