Forum Discussion

YoelKuliasko's avatar
YoelKuliasko
Qrew Cadet
8 years ago

Extract first names from List-user field.

A bit of a mystery to me:
The List-user field is called [Activity - Advisor]. From that field, I want to extract the first names.
When I make the formula as:
List(", ",
Left(Part(ToText(UserListToNames([Activity - Advisor])),1,";")," "),
Part(ToText(UserListToNames([Activity - Advisor])),2,";")
)
it behaves as expected, and extracts John, Jane Doo from the list-user field with values John Smith, Jane Doo.

However, when I make the formula the way I want it to, i.e.:
List(", ",
Left(Part(ToText(UserListToNames([Activity - Advisor])),1,";")," "),
Left(Part(ToText(UserListToNames([Activity - Advisor])),2,";")," ")
)
it only extracts John from above mentioned field, so QB seems to not look further for the second name; although I only added the "Left" function compared to the first formula.

What did I overlook?

Thanks!
  • List(", ",
    Left(Trim(Part(ToText(UserListToNames([Activity - Advisor])),1,";"))," "),
    Left(Trim(Part(ToText(UserListToNames([Activity - Advisor])),2,";"))," ")
    )
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      I am loving it - you helped me find an error in my grammar! I had the function User listed ahead of UserListToNames in my grammar so the parser was trying to match on the opening parenthesis.

      https://pastebin.com/TQGE65ZG

      I am going to write a script that will extract all the formulas from an application so I can run them through my grammar as test cases. Then I will invite everyone to send me their formulas so I can run 10,000 test cases. 
  • Hi Eric,
    No unfortunately not. Both your first reply with the "FF" as well as the edited version return this error:
    The types of the arguments or the number of arguments supplied do not meet the requirements of the function UserListToNames.
    The function UserListToNames can be used with the following arguments:
    UserListToNames (UserList ul, Text format).
    UserListToNames (UserList ul).
    which I also don't understand; when i look at Userlisttonames in the "All functions and operators" manual, this seems fine.

    I had based my formula on the one from https://community.quickbase.com/quickbase/topics/how-to-list-first-and-last-initials-from-list-user-... (which works fine, I tested it with my user-list field), so I don't see where I made an error, or how to fix it...
  • Hi Eric,
    tried it again and it works. Don't know what I did different yesterday.
    Thanks!