Discussions

Expand all | Collapse all

Extract first user from a user list

  • 1.  Extract first user from a user list

    Posted 04-11-2017 19:16
    I have a UserList field with a unknown number of users. Is it possible to extract the first user only? Bonus: is it possible to count the number of users in list field?


  • 2.  RE: Extract first user from a user list

    Posted 04-11-2017 19:49
    Show first user from a list-user field:
    ToUser(Part(ToText([User List]),1,";"))
    Count users in a list-user field (this handles up to 10):
    If(
    not IsNull(ToUser(Part(ToText([User List]),10,";"))), 10,
    not IsNull(ToUser(Part(ToText([User List]),9,";"))), 9,
    not IsNull(ToUser(Part(ToText([User List]),8,";"))), 8,
    not IsNull(ToUser(Part(ToText([User List]),7,";"))), 7,
    not IsNull(ToUser(Part(ToText([User List]),6,";"))), 6,
    not IsNull(ToUser(Part(ToText([User List]),5,";"))), 5,
    not IsNull(ToUser(Part(ToText([User List]),4,";"))), 4,
    not IsNull(ToUser(Part(ToText([User List]),3,";"))), 3,
    not IsNull(ToUser(Part(ToText([User List]),2,";"))), 2,
    not IsNull(ToUser(Part(ToText([User List]),1,";"))), 1
    )


  • 3.  RE: Extract first user from a user list

    Posted 04-11-2017 20:05
    Once the record is saved the user list is alphabetized so showing the first will always be the first in the list from A-Z.


  • 4.  RE: Extract first user from a user list

    Posted 04-11-2017 20:15
    Ahh, good point. Jonathan, can you clarify what you're trying to do here?


  • 5.  RE: Extract first user from a user list

    Posted 04-11-2017 20:42
    Hmm, I never realized the post-save alphabetization! Thanks for pointing that out Matthew. I believe this will invalidate the question, as I'd assumed that the order the users were put together would be retained, but appreciate the responses, Dan.