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

(Peter Westin) #1

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

(Suvrutt Gurjar) #2

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.

(Aleksi Alkio) #3

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

(Suvrutt Gurjar) #4

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.

(Aleksi Alkio) #5

@Suvrutt_Gurjar Yeap, that’s correct. Additional related table is needed.