Text file comparison

Hello,

I have two text files I need to fully compare. Meaning it cannot be line by line because changes can be made anywhere in file #2. Example:

  1. I have file#1 and file#2
  2. File#2 get edited and “anewword” is added somewhere in the text
  3. The compare needs to return the differences

How can I accomplish this?

Thanks,

Is it ok if we compare
. line 1 of file1 vs line 1 of file 2
. line 2 of file1 vs line 2 of file 2

. line n of file1 vs line n of file 2
?
If yes, you can use Generate DataTable activity to put data of 2 text files into 2 datatable variables.
Then use For each row activity to compare each row of file1’s datatable with same-index-row of file2’s datatable

Hi,

How about the following custom activity?

Regards,

It looks good. Never used custom activities. I’m going to install it now…I assume no problems publishing to the Orchestrator…correct?

@Doanh the problem with line by line is if the user inserts a line all the rest of the doc will be a mismatch…

In this case, you need to loop all row of file 2, then check if there’s same row in file1
If not → output that row

Instructions to install custom activity do not work…

I will try…but it won’t be precise. Sometime the doc has very long lines. If one word changes, the output will be this huge string…

Hi,

There is no difference with its behavior with / without orchestrator.However, you need to make robot can access the package such as add market place (former Go!) url to your robot settings if there isn’t, or put the package in your repository. The following document will help you.

Instructions to install custom activity do not work…

Can you try as the following image?

The community feed’s url is
https://gallery.uipath.com/api/v2

Regards,

I have the same URL under “GO”. I get an error “Central Directory corrupt” when I hit save after install…what a pain! Any idea?

Hi,

As a workaround, you can directly download the package (UiPathTeam.TextComparisonDesign.Activity.1.8.0.nupkg) from download link on left side in the page.
Then you need to put the package to your local repository, or add custom local feed url/path to settings of Package manger of Studio.

Regards,

I did that but the Manage Packages does not see it…

@Tex_Willer
where excactly did you saved the package?

In case of using a non standard location configure the path to additional sources
Manage Packages > User defined Package sources

Hi,

I just found size of the downloaded file from the web page is zero. There might be something wrong with the web page. Can you check your file?
If your file size is also 0, can you try the following file?

uipathteam.textcomparisondesign.activity.1.8.0.nupkg (20.1 KB)

Regards,

Thanks, now I was able to install it. Making progress. Next issue: I get a variable output error. Where do I find System.Collections Generic.List(Of Strings)? I found one but the activity still gives error.

Hi,

In which property do you have an error?

Text1 property and Text2 property should be String type.
Result property should be List<KeyValuePair<String,String>>.

Regards,

image

How do I select/find that type?

Hi,

We can easily create the proper type variable using Ctrl+k in the property. Can you try?

Regards,

Ok, that did it. One more thing…how do I use the output? I need to write it in a text file.

image

Thanks!