cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
StarfruitBob
Level VI

Identifying duplicate lists

Hello,

 

I have :ColA with n items. In :ColB there are string values. Once :ColB is changed to data type Expression, I’m able to use Words() to change the strings into a list. Then I use Sort List() to alphabetically sort the lists.

 

I want to compare the lists in :ColB between the n items in :ColA. Creating a subset of if both n items in :ColA share a common. Example, ItemA and ItemB in :ColA share an exact match of a list in :ColB. 

 

Using the Rows > Row Selection > Select Duplicate Rows functionality does not return what I expect when :ColB is selected.  I would expect, that if I use this functionality, create a subset of the automatically selected “duplicate” rows, and then sort :ColB, either ascending or descending, that I would find pairs of rows with the exact same lists.  This is not the case.  Each list is unique.

 

Any ideas of how to identify potential duplicate matches of lists for each n items in :ColA?

 

This will all be coded in JSL, I just need to know what's going on before I proceed.

Learning every day!
1 ACCEPTED SOLUTION

Accepted Solutions
StarfruitBob
Level VI

Re: Identifying duplicate lists

As it turns out, I was misinterpreting the function of Select Duplicate Rows. Since I had never used this function before, I thought it would select duplicate rows and the rows they were duplicating. The function as it works is exactly what I need.  I apologize for my delayed response.

Learning every day!

View solution in original post

3 REPLIES 3
StarfruitBob
Level VI

Re: Identifying duplicate lists

Since there's no reply to this yet, my workaround is to use a for loop and compare :colA for each row.  I'll look at rows n & n + 1 and if they're equal I'll flag them somehow and add to the for loop counter, because both of the rows will not need to be counted again.

I'd like to learn if someone has simple alternative.

Learning every day!
ErraticAttack
Level VI

Re: Identifying duplicate lists

In response to 

Any ideas of how to identify potential duplicate matches of lists for each n items in :ColA?

Here is an example.

Names Default to Here( 1 );
dt = New Table( "Untitled 490",
	Add Rows( 4 ),
	Compress File When Saved( 1 ),
	New Column( "A", Character, "Nominal", Set Values( {"A", "B", "C", "D"} ) ),
	New Column( "B",
		Expression,
		"None",
		Set Values( {{"A", "B"}, {"A", "b"}, {"B", "A"}, {"A", "B"}} )
	)
);

// this sorts the lists -- disable if you dont want to sort
For Each Row( dt,
	dt:B = Associative Array( dt:B[] ) << Get Keys
);

unique items = Associative Array( dt:B );
Jordan
StarfruitBob
Level VI

Re: Identifying duplicate lists

As it turns out, I was misinterpreting the function of Select Duplicate Rows. Since I had never used this function before, I thought it would select duplicate rows and the rows they were duplicating. The function as it works is exactly what I need.  I apologize for my delayed response.

Learning every day!