3 Replies Latest reply on Feb 4, 2009 11:26 AM by raybaudi

    Voting in Filemaker

    jbrigham

      Title

      Voting in Filemaker

      Post

      Hello -

       

      I'm trying to create a simple solution for allowing users to cast votes through a Filemaker database, preferably served out over the web.  I have a table of nominees and a related table of voters.  I have no trouble letting people vote, but I need to be able to limit everyone to only voting once for one nominee.  I have tried creating a unique field composed of the user's account name and a "voted" flag.  This works but is clumsy in that the errors returned are not very helpful or customizable.  I've also tried using custom access privileges but have not figured out how to impose the restrictions I need (e.g. user can create a record, but only one record, in the voter table).

       

      Can anyone offer other ideas to pursue?

       

      Thank you.

        • 1. Re: Voting in Filemaker
          raybaudi
             Hi jbrigham

          you can drive the thing with a script attached to a 'Vote' button having as script parameter the user's account name, something like:

          If [ not ValueCount ( FilterValues ( Get ( ScriptParameter ) ; List ( SelfJoin::UsersAccount ) ) ) ]
          New Record/Request
          Set Field [ Vote ; theCurrentVote ]
          End If



          • 2. Re: Voting in Filemaker
            jbrigham
              

            Thank you Daniele, I really appreciate your response.  To the extent that I understand it, this seems like a promising solution.  If you wouldn't mind,  could you explain it a bit?  I think the logic is "If there is not a record for this user yet, set the vote field."   Is this what's happening?

             

            Thanks much.

             

            John

             

             

            • 3. Re: Voting in Filemaker
              raybaudi
                

              Hi Jbrigham

               

              > I think the logic is "If there is not a record for this user yet, set the vote field."   Is this what's happening?

               

              If there is not a record for this user yet, CREATE a new record AND set the vote field.

               

              List ( SelfJoin::UserAccount ) gives a list of user accounts ( IOW a list of all related records with a 'vote' field not empty )

               

              FilterValues ( Get ( ScriptParameter ) ; List ( SelfJoin::UserAccount ) ) gives a value ONLY if that List contains the value: Get ( ScriptParameter ) [ aka an userAccount ]

               

              So we check that ValueCount ( FilterValues ( Get ( ScriptParameter ) ; List ( SelfJoin::UsersAccount ) ) ) is 0 and, IF YES, create a new record.