cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
XRQ57
Helper I
Helper I

Comparing 2 lists (txt files)

Hi Everyone,

I am trying to compare 2 text files.

The 1st list is a txt file that i created and the second one is a list from a PDF file. I have extracted the text from the PDF and save the text in a txt file.

 

For the 2 files, i choose these options :

- Store content as : List (each is a list Item)

- Encoding : UTF-8

 

For the PDF to txt :

Encoding : UTF - 8

 

Here is a part of the value from the PDF.

 

XRQ57_1-1629971113338.png

and the values from the other list

XRQ57_3-1629971277371.png

 

 

The result of finding common list item is blank.

Of course, i tried to compare the first list with itself and it works. Same result for the second list.

 

I even took the value from the pdf file and copy/past to my first list, but the result is the same, blank.

 

Thanks for your help

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
XRQ57
Helper I
Helper I

I found the solution.

No need to create a list because items are still in a list when reading the txt file. (Store content as : List (each is a list Item).

So i compare "%fileContents% 😉

 

View solution in original post

5 REPLIES 5
MichaelAnnis
Memorable Member
Memorable Member

MichaelAnnis_0-1629989645206.png

 

This logic should work for comparing 1 list to another.  In this example, only list 1 is being looked for in list 2 and all the unmatched items are being added to a 3rd list.  You could essentially repeat this logic and have list 2 look for matches in list 1 in order to get it done both ways.

I am a firm believer in VBA, and you could probably do this much faster in VBA by writing both lists to Excel and running a Macro, but this PAD solution will work.

 

Best of luck!

John_Mavridis
Microsoft
Microsoft

Hello,

There is a dedicated action that compares one list versus the other for common items, 'Find common list items'.

 

@XRQ57 Have you checked for any whitespaces hidden at the beginning and/or end of the value "SUEZ RV NORD EST"? For instance, if this item in the first list has no such whitespaces, but the item in the second list does, then they are basically considered different values.

 

'Trim text' is a handy action for that purpose, should you need it.

Hi,

thanks for the answer.

I used 'Trim text", but it does not work.

I made few tests :

 

List 1 and 2 have the same unique value => it works

List 1 have 2 values and list 2 only one value => not working

When i use Trim text, items are stocked like this

 

Without 'Trim text", values are stocked like this

XRQ57_1-1630046495830.pngXRQ57_2-1630046513312.png

 

With 'Trim text'

The fileContents are the same but not the list. The comma is missing

XRQ57_3-1630046638758.png

I don't understand what is wrong

 

XRQ57
Helper I
Helper I

I found the solution.

No need to create a list because items are still in a list when reading the txt file. (Store content as : List (each is a list Item).

So i compare "%fileContents% 😉

 

View solution in original post

John_Mavridis
Microsoft
Microsoft

Glad to know you made it work!

 

Regarding the 'Trim text' action, I was referring to apply that to each list item in both lists (as in iterate through the lists and update their items accordingly), before comparing the lists versus each other.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,069)