Forum Discussion

JonathanHeuer's avatar
JonathanHeuer
Qrew Cadet
8 years ago

Extract first user from a user list

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?
  • 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
    )
    • MCFNeil's avatar
      MCFNeil
      Qrew Captain
      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.
    • DanLadner1's avatar
      DanLadner1
      Qrew Trainee
      Ahh, good point. Jonathan, can you clarify what you're trying to do here?
    • JonathanHeuer's avatar
      JonathanHeuer
      Qrew Cadet
      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.