How to compare a different text file and its data inside of it, after the extraction?
what you’re comparing Can you provide a specific scenario?
Here’s the scenario:
Check the filename on both file if they are the same name? Note: No need to print it out just TRUE OR FALSE.
Check all the possible data inside the file LINE-BY-LINE? Note: if there’s some file with data that does not match to other file with data, use Append Line Activity to store the data comparison.
[Example Output Results] filter_message.cfg before_change(line:1) : #test1 after_change : filter_time.cfg before_change(line:6) : #test2 after_change (line:6) : #test3
Did you already see my message?
Give me 30 minutes and I will provide you with a solution.
Okay thank you so much.
Hey @fniedez ,
I created one sample workflow based on your requirements Please check and mark this post as a solution if you found the answer you were looking for.
TextCOmpare.zip (5.5 KB)
To compare a different text file and its data inside of it after the extraction in UiPath, you can use the
Read Text File activity to read the contents of both text files into string variables, and then use the
Compare activity to compare the contents of the two variables.
Here are the steps to do this:
- Use the
Read Text Fileactivity to read the contents of the first text file into a string variable. Specify the path to the text file in the
Read Text Fileactivity’s
- Use the
Read Text Fileactivity to read the contents of the second text file into another string variable.
- Use the
Compareactivity to compare the contents of the two string variables. Set the
Expectedproperty to the first string variable and the
Actualproperty to the second string variable.
- Use an
Ifactivity to check the result of the comparison. If the
True, the contents of the two text files are the same. If the
False, the contents of the two text files are different.
Here is an example of how this could be implemented in UiPath:
ReadTextFile file1 = new ReadTextFile();
file1.FilePath = “C:\file1.txt”;
ReadTextFile file2 = new ReadTextFile();
file2.FilePath = “C:\file2.txt”;
Compare compare = new Compare();
compare.Expected = file1;
compare.Actual = file2;
If ifActivity = new If();
ifActivity.Condition = compare;
ifActivity.Then = new Sequence();
ifActivity.Then.Add(new WriteLine(“The contents of the two text files are the same.”));
ifActivity.Else = new Sequence();
ifActivity.Else.Add(new WriteLine(“The contents of the two text files are different.”));
This code reads the contents of both text files into string variables, compares the contents of the two variables using the
Compare activity, and outputs a message depending on the result of the comparison.
Sorry for late reply, I’ll check you flow there’s no activity that extract two different zip files.
Note: And the results that I need is like this:
filter_message.cfg before_change(line:1) : #test1 after_change : filter_time.cfg before_change(line:6) : #test2 after_change (line:6) : #test3
I already sent a message to you, kindly check it.
Can you please do this on the activity or in a flow. Pardon, I didn’t catch your answer.