AeroDev
2 months agoQrew Member
Conversion from user identifier to UserList
Hello,
Has anyone found a more elegant solution to the problem of a list of user identifiers like ID's, usernames, emails, and casting or converting it to a UserList data type?
I have found people mentioning a variation of the brute force approach which is essentially what I use. I have a count and conditionals to try to reduce needless processing. My total runtime is 0.073 seconds.
ToUserList(
If([Related Users - Count of Viewer Users] > 0, ToUser(Trim(Part(ToText([Related Users - View Access]), 1, ";")))),
If([Related Users - Count of Viewer Users] > 1, ToUser(Trim(Part(ToText([Related Users - View Access]), 2, ";")))),
If([Related Users - Count of Viewer Users] > 2, ToUser(Trim(Part(ToText([Related Users - View Access]), 3, ";")))),
If([Related Users - Count of Viewer Users] > 3, ToUser(Trim(Part(ToText([Related Users - View Access]), 4, ";")))),
If([Related Users - Count of Viewer Users] > 4, ToUser(Trim(Part(ToText([Related Users - View Access]), 5, ";")))),
If([Related Users - Count of Viewer Users] > 5, ToUser(Trim(Part(ToText([Related Users - View Access]), 6, ";")))),
If([Related Users - Count of Viewer Users] > 6, ToUser(Trim(Part(ToText([Related Users - View Access]), 7, ";")))),
If([Related Users - Count of Viewer Users] > 7, ToUser(Trim(Part(ToText([Related Users - View Access]), 8, ";")))),
If([Related Users - Count of Viewer Users] > 8, ToUser(Trim(Part(ToText([Related Users - View Access]), 9, ";")))),
If([Related Users - Count of Viewer Users] > 9, ToUser(Trim(Part(ToText([Related Users - View Access]), 10, ";")))),
If([Related Users - Count of Viewer Users] > 10, ToUser(Trim(Part(ToText([Related Users - View Access]), 11, ";")))),
If([Related Users - Count of Viewer Users] > 11, ToUser(Trim(Part(ToText([Related Users - View Access]), 12, ";")))),
If([Related Users - Count of Viewer Users] > 12, ToUser(Trim(Part(ToText([Related Users - View Access]), 13, ";")))),
If([Related Users - Count of Viewer Users] > 13, ToUser(Trim(Part(ToText([Related Users - View Access]), 14, ";")))),
If([Related Users - Count of Viewer Users] > 14, ToUser(Trim(Part(ToText([Related Users - View Access]), 15, ";")))),
If([Related Users - Count of Viewer Users] > 15, ToUser(Trim(Part(ToText([Related Users - View Access]), 16, ";")))),
If([Related Users - Count of Viewer Users] > 16, ToUser(Trim(Part(ToText([Related Users - View Access]), 17, ";")))),
If([Related Users - Count of Viewer Users] > 17, ToUser(Trim(Part(ToText([Related Users - View Access]), 18, ";")))),
If([Related Users - Count of Viewer Users] > 18, ToUser(Trim(Part(ToText([Related Users - View Access]), 19, ";")))),
If([Related Users - Count of Viewer Users] > 19, ToUser(Trim(Part(ToText([Related Users - View Access]), 20, ";"))))
)