Hi All,
I am trying to merge 2 lists and remove its duplicates. I tried the following:
UNIQUE(
[Teaching_Tips_1]+
LOOKUP(
MAXROW(
"Class_Observations"
,
"Modified On"
,
[_THISROW].[Student] = [Student]
)
,
"Class_Observations"
,
"Key"
,
"Add_Objective_1_Teaching_Tips"
)
)
and received this error:
Arithmetic expression '([Teaching_Tips_1]+ANY(SELECT(Class_Observations[Add_Objective_1_Teaching_Tips],([Key] = ANY(SELECT(Class_Observations[Key],AND(([Key].[Student] = [Student]), ([Modified On] = MAX(SELECT(Class_Observations[Modified On],([Key].[Student] = [Student])))))))))))' has inputs of an invalid type 'Unknown'
So i tried this:
UNIQUE(
[Teaching_Tips_1]+
List(LOOKUP(
MAXROW(
"Class_Observations"
,
"Modified On"
,
[_THISROW].[Student] = [Student]
)
,
"Class_Observations"
,
"Key"
,
"Add_Objective_1_Teaching_Tips"
))
)
No error but the duplicates arenโt stripped away.
Note that this code is used in an action:
Any help is appreciated. Thank you.
Alex
You need to use lists with the addition (+)โฆ meaning LIST()+LIST().
Hi Aleksi,
I did try that and I still end up with duplicates.
UNIQUE(
List([Teaching_Tips_1])+
List(LOOKUP(
MAXROW(
"Class_Observations"
,
"Modified On"
,
[_THISROW].[Student] = [Student]
)
,
"Class_Observations"
,
"Key"
,
"Add_Objective_1_Teaching_Tips"
))
)
-LIST("")
at the end. UNIQUE sometimes seems to fail in these circumstances.
Thx Dave. Doesnโt seem to work either in both case below.
UNIQUE(
LIST([Teaching_Tips_1])+
LIST(LOOKUP(
MAXROW(
"Class_Observations"
,
"Modified On"
,
[_THISROW].[Student] = [Student]
)
,
"Class_Observations"
,
"Key"
,
"Add_Objective_1_Teaching_Tips"
))-LIST(" ")
)
UNIQUE(
LIST([Teaching_Tips_1])+
LIST(LOOKUP(
MAXROW(
"Class_Observations"
,
"Modified On"
,
[_THISROW].[Student] = [Student]
)
,
"Class_Observations"
,
"Key"
,
"Add_Objective_1_Teaching_Tips"
))
)-LIST(" ")
I donโt think it matters but both lists contains keys of the table Teaching Tips that are generated with UNIQUEID().
No space in between the quotes. Just double quotes right next to each other.
Same. In both cases. Which case you wanted me to try?
โ LIST() usually works for me. Iโve not tried the UNIQUE() function yet.
@Brandt_Litton @Bahbus
Is that what you were thinking about?
UNIQUE(LIST("a, b, c, d, e")+LIST("d, e")-LIST())
The current test data is similar but it keeps returning LIST(โa, b, c, d, e, d, eโ)
Yes. But, like I said, Iโve only done that same thing without the UNIQUE() part of the expression. So for me itโs usually LIST(โฆ)+LIST(โฆ)+LIST(โฆ)-LIST() to get rid of duplicates.
this sounds terrible but maybe I can do LIST(A)+LIST(B)-INTERSECT(LIST(A), LIST(B))
or can I wrap the LIST(A) and LIST(B) in a select and use the argument to remove the duplicate?
Does work:
LIST("a", "b", "c", "d", "e")+LIST("d", "e", "f")-LIST("")
= {a, b, c, d, e, f}
Doesnโt work for me. Maybe the issue comes from this mismatch type.
Wait. Is [Teaching_Tips_1] an EnumList? Thatโs the reason itโs not working. LIST([EnumList Column]) Iโm pretty sure takes the content of the EnumList {โtest1โ, โtest2โ} (2 items) and converts it into a new list of {โtest1, test2โ} (1 item). Then itโs {โtest1, test2โ} + {โtest2โ} = {โtest1, test2โ , โtest2โ} (2 items). Thatโs why UNIQUE() and the -LIST("") arenโt working. As far as the expression is concerned, theyโre different.
So try these two options:
UNIQUE(
[Teaching_Tips_1]+
LIST(LOOKUP(
MAXROW(
"Class_Observations"
,
"Modified On"
,
[_THISROW].[Student] = [Student]
)
,
"Class_Observations"
,
"Key"
,
"Add_Objective_1_Teaching_Tips"
))
)
If that doesnโt work, try:
UNIQUE(
SPLIT([Teaching_Tips_1], ",")+
LIST(LOOKUP(
MAXROW(
"Class_Observations"
,
"Modified On"
,
[_THISROW].[Student] = [Student]
)
,
"Class_Observations"
,
"Key"
,
"Add_Objective_1_Teaching_Tips"
))
)
@Bahbus Thanks so much, I added the SPLIT for both columns and it works great
Just a question, why an EnumList of Ref isnโt a regular LIST?
Mostly because its a mishmash of two seperate column types. But this problem would occur even if the column was of the List type (I think). Either way, the list is โstoredโ as a string of text separated by comma (or a different delimiter if you define it). It would be equivalent to LIST(โAโ, โBโ, LIST(โAโ, โBโ)), but the editor can recognize that as a no-no.
@Bahbus I think I am having the same issue with enumlist of Ref again.
I am trying to use the current filter on a Slice of table B:
IN(
[Gym]
,
LOOKUP(CONTEXT(โDeviceโ), โUser_Profilesโ, โDeviceโ, โCard Scopeโ)
)
It always return false even with the correct data. So I tried:
IN(
[Gym]
,
SPLIT(LOOKUP(CONTEXT(โDeviceโ), โUser_Profilesโ, โDeviceโ, โCard Scopeโ), โ,โ)
)
Still doesnโt work.
I did notice the filter working when I change the order of the values in the field Card Scope.
Any idea? Thx!
Try:
Try:
AND(
TRUE,
IN(
[_THISROW].[Gym],
SPLIT(
LOOKUP(
CONTEXT(โDeviceโ), โUser_Profilesโ, โDeviceโ, โCard Scopeโ
), โ,โ
)
)
)
Thanks. I copied just a part of the filter. There are already other conditions.
I donโt think the issue come from the context(device). I do have the same one for my test.
Is there a way to know exactly the list that gets return from the lookup? Some sort of debug print ability.
Using the test button on test button on that expression should show you.
Doesnโt work either. Thanks though.
Well, Context(โDeviceโ) based stuff can kind of be difficult to debug. Because, the browsers UUID changes fairly easily, and when youโre playing around in the editor, youโre on the browser. But I believe, Iโve also seen reports in general of issues using IN() as the only condition of a slice. Donโt know if that ever got fixed.
User | Count |
---|---|
41 | |
27 | |
26 | |
20 | |
13 |