Removing duplicates from a card view

I have searched the posts regarding removing duplicates (which there a many) but I am still struggling to figure this out.

I have a table called Rods which has the following set up:

RodNumber RodID LureImage PrimaryColor SecondaryColor Box Space DateTime
1 34e061b5 Harness_Images/34e061b5.HarnessImage.230524.jpg White None 1 7 2021-01-30 12:43
2 7aca3bef Harness_Images/7aca3bef.HarnessImage.230749.jpg Yellow Orange 2 7 2021-01-30 13:55
3 dca35c51 Harness_Images/dca35c51.HarnessImage.230910.jpg White None 1 7 2021-01-30 14:05
1 215ba466 Harness_Images/215ba466.HarnessImage.234519.jpg Clear Black 1 7 2021-01-30 16:43
2 132a84a7 Harness_Images/132a84a7.HarnessImage.234550.jpg Blue Purple 1 7 2021-01-30 17:31
2 a0cfca40 Harness_Images/a0cfca40.HarnessImage.235039.jpg Orange None 1 7 2021-01-30 17:43
4 41a3b448 Harness_Images/41a3b448.HarnessImage.235323.jpg Orange Black 1 7 2021-01-30 18:27

My goal is to create a Card View of Backdrop type having the Title be the RodNumber and the image being LureImage. However, I want to only show the unique Rod Numbers from Today removing the duplicates based on the last row entered for the give RodNumber. I would only want the view to show Row 3, 4, 6, 7. I have tried using the expressions Filter, MaxRow and a few others without luck. Any help would be greatly appreciated. Thanks!

Please try the following.

Please create a slice on the table with an expression something like

IN ( [Rods Table’s Key Column] , MAXROW(“Rods” , “DateTime” , AND(DATE(Date Time]) =TODAY(), [RodNumber]=[_THISROW].[RodNumber])))

Please base the card view on this slice.

2 Likes

Thank you @Suvrutt_Gurjar for your help. I tried to create a slice with:

IN([RodID] , MAXROW(“Rods” , “DateTime” , AND(DATE([DateTime]) =TODAY(), [RodNumber]=[_THISROW].[RodNumber])))

Unfortunately I am getting the error: Parameter 2 of function IN is of the wrong type

Looking at the Appsheet Help information for the IN function:

Syntax

IN( needle , haystack )

Arguments

needle (any): The value to be found. This value’s type must be compatible with that of the items of the search list ( haystack ).

haystack ( EnumList or List of any): A list of items to be searched. The type of items must be compatible with that of the search target ( needle ).

Am I getting the error since [RodID] is the primary key as a text field receiving initial value UNIQUE(ID) and we are using [DateTime] which is a datetime field in the second parameter. Therefore, the text and datetime fields are not of the same data type. [RodNumber] is also used in the second parameter and is a text field. Thanks again for your help!

Please try

IN([RodID] , LIST(MAXROW(“Rods” , “DateTime” , AND(DATE([DateTime]) =TODAY(), [RodNumber]=[_THISROW].[RodNumber]))))

I believe you were geting error because haystack needs to be a list. Now we have wrapped MAXROW() with a LIST() function.

Edit:
Another option for slice filter expression could be

[RodID] = MAXROW(“Rods” , “DateTime” , AND(DATE([DateTime]) =TODAY(), [RodNumber]=[_THISROW].[RodNumber]))

2 Likes

Thank you @Suvrutt_Gurjar! The expression:

IN([RodID] , LIST(MAXROW(“Rods” , “DateTime” , AND(DATE([DateTime]) =TODAY(), [RodNumber]=[_THISROW].[RodNumber]))))

solved my problem. Thanks again!!

2 Likes