Compare excel sheet

I want to iterate and check the Model_Name from this two sheet
image

how to check the model name
String.Equals(AmzMN,FlpMN, StringComparison.OrdinalIgnoreCase)
above condition doesn’t work

@AbarnaKalaiselvam

You can try like this as names are little unordered …Instead of actual value use the currentrow(“Column”).ToStrinng

String.Join(",",Regex.Split("Apple Iphone 14(Red,128 GB)".Tolower,"\W").Where(function(x) Not String.IsNullOrEmpty(x)).OrderBy(function(x) x)).Equals(String.Join(",",Regex.Split("Apple Iphone 14(128 GB) - Red".ToLower,"\W").Where(function(x) Not String.IsNullOrEmpty(x)).OrderBy(function(x) x)))

image

Note: All words should be same…if words are different then this might not work

cheers

Regex is a varoftype?

@AbarnaKalaiselvam

Regex is a class which contains a split function which can work with regularExpressions

Full NameSpace : System.Text.RegularExpressions.Regex.Split

cheers

@AbarnaKalaiselvam

Please use fullnamespace instead of regex.Split

System.Text.RegularExpressions.Regex.Split

cheers

nice its wroking
can you explain the function of the code
String.Join(“,”,System.Text.RegularExpressions.Regex.Split(AmzMN.Tolower,“\W”).Where(Function(x) Not String.IsNullOrEmpty(x)).OrderBy(Function(x) x)).Equals(String.Join(“,”,System.Text.RegularExpressions.Regex.Split(FlpMN.ToLower,“\W”).Where(Function(x) Not String.IsNullOrEmpty(x)).OrderBy(Function(x) x)))

@AbarnaKalaiselvam

I am splitting the string based on any non words character(space,comma,etc) and then ordering all the words and joining them together so that the words on each side if they are same would match…and also removing any empty spaces that i see

String.Join(“,”, - joins using comma
System.Text.RegularExpressions.Regex.Split(AmzMN.Tolower,“\W”). - split the string using any special character
Where(Function(x) Not String.IsNullOrEmpty(x)). - removes empty strinngs from array
OrderBy(Function(x) x)) - orders the array in ascending order

Eg : input 1 : abc def
Inout2 : def abc

Now the function will split on space and then arrange both as per name and then it compares so comprision will be abc,def and abc,def…so both would match

Hope this is clear

Cheers

thakyou @Anil_G Now its clear

1 Like

@AbarnaKalaiselvam

Happy Automation

cheers

23.4.1+Branch.master.Sha.43c76fe6d960fdc239be3af93d0fd47b8ca81224

Not enough memory resources are available to complete this operation.

Error: System.Exception: Not enough memory resources are available to complete this operation.
at System.Diagnostics.Eventing.EventProvider.EtwRegister()
at System.Diagnostics.Eventing.EventProvider…ctor(Guid providerGuid)
at System.Activities.Presentation.DesignerPerfEventProvider…ctor()
at System.Activities.Presentation.View.TypeBrowser.TypeBrowserView…ctor(AssemblyContextControlItem assemblyContext, EditingContext context, Func`2 filter)
at System.Activities.Presentation.View.TypePresenter.HandleBrowseType()
at System.Activities.Presentation.View.TypePresenter.OnTypePresenterDropDownClosed(Object sender, EventArgs e)
at System.Windows.Controls.Primitives.Popup.OnClosed(EventArgs e)
at System.Windows.Controls.Primitives.Popup.DestroyWindow()
at System.Windows.Threading.DispatcherTimer.FireTick()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2147467259

@AbarnaKalaiselvam

Can you please raise it as a different topic…looks like complete different issue. And also make sure to provide more details of where the error occured and all when you create the topic

This helps in segregation of issues

cheers

resolved after restarting UiPath

1 Like

@AbarnaKalaiselvam

Could you please close the topic if resolved else happy to help

Cheers

1 Like

@Anil_G
Not String.Join(“,”, System.Text.RegularExpressions.Regex.Split(AmzMN.ToLower, “\W”).Where(Function(x) Not String.IsNullOrEmpty(x)).OrderBy(Function(x) x)).Equals(String.Join(“,”, System.Text.RegularExpressions.Regex.Split(FlpMN.ToLower, “\W”).Where(Function(x) Not String.IsNullOrEmpty(x)).OrderBy(Function(x) x)))
is this correct?
if the two sheet does not have the equal match i want to write the product name in the 3rd excel

@AbarnaKalaiselvam

Yes this is correct for checking the condition…true when not matched

Cheers

Actuallay i have 3 sheets




Compare the equal model_name from the first two sheets and write in the third sheet.

If the Model name are not equal, i want to write the model_name and price in the third sheet from amazon sheet as amazon in the lowest price. like wise if the flipkart how to done this?

@AbarnaKalaiselvam

  1. Read the data from both excels into dt1 and dt2
  2. Add new column to both datatables may be name them combined name
  3. Use invoke code activity and assign values to that new column.dt1 can be added as argument in invoke code with direction as in/out dt1.AsEnumerable.ToList.ForEach(Sub(x) x("NewCol") = String.Join(“,”, System.Text.RegularExpressions.Regex.Split(x("Model_Name").ToString.ToLower, “\W”).Where(Function(y) Not String.IsNullOrEmpty(y)).OrderBy(Function(y) y))) .Repeat the same for dt2
  4. Now use join activity and do a full join on both the datatables on the newcolumn created
  5. Now filter dt1 related columns to get the mismatched detaisl from dt2 and viceversa

From step 4 I did keep screenshots as well in the below post

Cheers

@AbarnaKalaiselvam

Amzndt should be added as an argument to invoke code and direction is in/out

Cheers