List(1 , 2 , 3 , 3 , 4) - list(1 , 2 , 3 , 4) = list() <--blank?

Iโ€™m trying to find the duplicates of a list, this way I can base a special formatting rule off of it, but Iโ€™m running into the intelligence of the platform doing something Iโ€™m not wanting

Like the title says, I have the following expression results:

list(1 , 2 , 3 , 3 , 4) - list(1 , 2 , 3 , 4) = list()

  • The first list has two 3s in there (thatโ€™s the duplicate I need to isolate out, and any others).
  • The second list is generated FROM the first list via UNIQUE()
    So I guess you could test: list(1 , 2 , 3 , 3 , 4) - UNIQUE(list(1 , 2 , 3 , 3 , 4))

Iโ€™m looking for the result: list(3) - because if I take things one-for-one thatโ€™s what I would get.

But AppSheet is an intelligent platform, and before a few months ago we didnโ€™t have the UNIQUE() function, so (after tons and tons of bugging) the devs put in some auto-magic to make lists unique when you do any list-math on them.

But we have UNIQUE() now, so this behavior is actually a hindrance.


I was hoping that LIST() might tell the system, โ€œHey, take this list literally; subtract one from the other and donโ€™t do any magic.โ€

But no. @Adam any suggestions? Thanks

Edit: Feature Request: DUPLICATES()??? NONUNIQUE()โ€ฆ THEREPEATINGONES(), DOPPELGANGERS(), CLONES()

3 6 578
6 REPLIES 6

+1 for a doppelgangers expressionโ€ฆ

Whenever an operator is used, a defined standard needs to be established. In many systems, there is ALSO an analogous function provided (e.g. SUBTRACT()) which allows variations based on parameter settings. The operator is really just a shorthand syntax for the most most common function usage.

It seems thats what is needed here, a SUBTRACT() or SUBTRACTLIST() function that allows for parameter (or two) to specify to remove/keep duplicatesโ€ฆand any other useful feature parameters!!

A DUPLICATES() function appears to be a specialized case of SUBTRACT().

Hi @MultiTech_Visions did you find a workaround to detect duplicates in a list?

Theoretically;
LIST(1 , 2 , 3 , 3 , 4) - LIST(1 , 2 , 3 , 4) != LIST() as LEN(LIST[0]) = 5 where LEN(LIST[1]) = 4. However when tested the expression editor treats it like LIST(1 , 2 , 3 , 3 , 4) == UNIQUE(LIST(1 , 2 , 3 , 3 , 4)) == LIST(1 , 2 , 3 , 4) and therefore the initial equation results as LIST(). I wonder, if LIST() expression already eliminates the duplicate values in a list during eval, whatโ€™s the need for the UNIQUE() function then?

Itโ€™s not LIST() doing it, itโ€™s the list-subtract (-) operator.

Prior to UNIQUE(), subtracting an empty list was how I recommended deduplicating lists.

Thanks for the tip @Steve

Top Labels in this Space