I have an enumlist column with PackedUUID Ids. Now I want to get a distinct id list of some rows.
The problem is that I get one or many ids on each row. So my Idea is to simply concatenate the select and split them back into a list with -hopefully- only single ids and without leading or trailing whitespaces. So that I can use them to select the related value.
However, this does not appear very professional. So my question is if there are concepts for that already or even ready to go methods?
Solved! Go to Solution.
That is the way it's done in AppSheet. I'd write the expression like this:
sort(
select(
Table_Employee[_name],
in([ID], split(("" & Table_Contract[Table_Employee]), " , "))
)
- list("")
)
1. Your use of UNIQUE() had no practical effect so I removed it.
2. ("" & ...) has the same effect as concatenate(...) when casting a single value to Text. It's also more compact. I favor it when the expression to cast is itself shorter. See also Text expressions
3. Table_Contract[Table_Employee] is a shorter way to express select(Table_Contract[Table_Employee], true). See also Construct a list from table-column references
4. ... - list(""): Subtracting a list from another list will automatically squash duplicate entries. Subtracting a blank Text value ("") removes any blank values from the original list. See also Subtract values from a list
To understand what I mean, this works:
Table_Contract[Table_Employee] is the EnumList in question.
select(Table_Employee[_name],
in([ID],
unique(
split(
concatenate(
select(Table_Contract[Table_Employee], true)
), " , ")
)
)
)
But is there a bit more elegant solution for that?
That is the way it's done in AppSheet. I'd write the expression like this:
sort(
select(
Table_Employee[_name],
in([ID], split(("" & Table_Contract[Table_Employee]), " , "))
)
- list("")
)
1. Your use of UNIQUE() had no practical effect so I removed it.
2. ("" & ...) has the same effect as concatenate(...) when casting a single value to Text. It's also more compact. I favor it when the expression to cast is itself shorter. See also Text expressions
3. Table_Contract[Table_Employee] is a shorter way to express select(Table_Contract[Table_Employee], true). See also Construct a list from table-column references
4. ... - list(""): Subtracting a list from another list will automatically squash duplicate entries. Subtracting a blank Text value ("") removes any blank values from the original list. See also Subtract values from a list
User | Count |
---|---|
33 | |
11 | |
3 | |
2 | |
2 |