2 Replies Latest reply on Aug 31, 2009 8:47 AM by mrvodka

    Randoms for multiple companies

    skeefu

      Title

      Randoms for multiple companies

      Post

      I have created a script that pulls Randoms for any number amount I enter in for 'one' company.

      I would like to be able to pull Randoms on a say, quaterly basis for multiple companies. I have created a field for each company that holds the number for the frequency and a field for whether it's quarterly or monthly. the problem is, that, if say, company one wants 5 random employees pulled, company  two wants 3 random employees pulled,company three wants 3 random employees pulled, etc..

      how can I created a script that will pull for all companies with one script.

       

      thank you in advance.

       

      Greg

        • 1. Re: Randoms for multiple companies
          TSGal

          skeefu:

           

          Thank you for your post.

           

          FileMaker has a random function that assigns a random value between 0 and 1.    Therefore, you can create a script that finds a particular set of records, assigns a random number, and then sorts by that random number.  If you want five random records, then use the first five records.  If you want three, then use the the first three records.  Run the script again, and you'll see a different set of five or three records.  The script may include

           

          Find [ Restore ]

          Replace Field Contents [ No dialog ; <field holding random results> ; Random ]

          Sort [ Restore ]

           

          If you already have a subset of records, then you can remove the Find script step.

           

          If you need clarification for any of the above steps, please let me know.

           

          TSGal

          FileMaker, Inc. 

          • 2. Re: Randoms for multiple companies
            mrvodka
              

            TSGal wrote:

            skeefu:

             

            Thank you for your post.

             

            FileMaker has a random function that assigns a random value between 0 and 1.

            <snip>

             

             

            TSGal

            FileMaker, Inc. 


             

            I just wanted to be a little more precise here. Random () assigns a random value that is less than 1 and greater or equal to 0. 

             

            Also wanted to state for the public that this works correctly with the 10.0v3 patch and that previous to that patch, Random () had issues.