Count unique records

Tagged: 

Viewing 3 reply threads
  • Author
    Posts
  • December 13, 2018 at 12:22 PM #32643

    krys nystrom
    Participant

    How would I go about counting unique records? I have a timesheet with multiple employees and multiple projects, and would like to count the number of unique employees per project.

    And thanks so much for this program!! I’ve used filemaker for years till their ridiculous upgrades caused me to stop using it altogether…

    December 13, 2018 at 1:41 PM #32645

    Brendan
    Keymaster

    Hello Krys,

    It depends on what you mean by “unique”. Is there a particular field which defines a value that may have duplicates in it that you want to count the number of unique values for?

    You could do that by writing a Form Script which loops through all the records in your form, getting the value for that field and counting the number of unique values. You could add the value to a JavaScript Set which would guarantee that only unique values are added to it. Then you could just get the size of the Set.

    See this link for info on Sets in JavaScript:

    https://alligator.io/js/sets-introduction/

    Thanks,

    Brendan

    December 18, 2018 at 12:38 AM #32767

    Ted
    Participant

    Is this how I would get a pick list that removes an option that had previously been selected?

    Example: allocating seats on a bus – you can’t sell the same seat twice for the same trip.

    Or is there an easier way without messing with Java Script?

    December 18, 2018 at 2:25 PM #32783

    Brendan
    Keymaster

    Hi Ted,

    There’s no JavaScript API to update the list of values in a Pick List. But you could do this with a Many to Many Link to Form field. You could have a Bus form that has a Link to Form field connected to an Available Seats form. Then when you click the checkmark button to add a seat to the Link to Form field on your Bus form, Tap Forms will show you only the records that haven’t been linked yet.

    So maybe that’ll help.

    Thanks!

    Brendan

Viewing 3 reply threads

You must be logged in to reply to this topic.