Search name after ] this backet

datadt.xlsx (8.4 KB)
can some one help to to provide xaml for this case

here:- I have to extract name after ] from E column

and
second, I have to check all names are same or not

Hi

Hope these steps would help you resolve this

  1. Use a excel application scope and pass the file path as input and use a read range activity with add headers property disabled in its property panel and get the output as dt

  2. Then use a FOR EACH ROW activity and pass the dt as input

  3. Inside the loop use a ADD TO COLLECTIONS activity and mention the property like this

Collections = list_names

Where list_names is a variable of type System.Collections.Generic.List(of string) defined in variable panel with default value as New List(of string)

And in item property mention as

Split(row(dt.Columns.Count-1).ToString,”]”)(1).ToString.Trim

This will get the name after ]

And as next property in add to collections change the argument as string

  1. Next to this loop use a Assign activity like this

Bool_same = list_names.Distinct().ToList().Count.Equals(1)

If true it will give as true if not false m
True means all values are same else it is different

Hope this would help you

Cheers @ashishmani

Hi @ u can check this whether all names are same or not using single if condition itslef


dt1.AsEnumerable().Select(Function (row) System.Text.RegularExpressions.Regex.Match(row(4).ToString,"(?<=\]).*").Value.ToString).ToList().Distinct.Count=1

Regards

Nived N :robot:

can you help me to make xaml for me.

can you help me to make xaml for this.

test.xaml (6.9 KB)

Add To Collection: The property ‘Collection’ of ‘Add To Collection’ is not initialized.

its always send the true value, even name is different

this only return the count of the name

You are almost done
Make sure you have created a variables in the variable panel and it has a default value

Where list_names is a variable of type System.Collections.Generic.List(of string) defined in variable panel with default value as New List(of string)

Cheers @ashishmani

1 Like

I already did it, still have issue, please check my xaml

Is this done
@ashishmani

could you please share workflow Palnyappan I appreciate

It always send true, even name is different

test.xaml (7.8 KB)
datadt.xlsx (8.1 KB)

image

Fine
As per the image I thought the column we want is the last column
But it looks like we have two columns after them so let’s mention the index position
Like this

Try with below expression replacing the above one

IF(String.IsNullOrEmpty(row(4).ToString.Trim),String.Empty,Split(row(4).ToString,”]”)(1).ToString.Trim)

I mentioned as 4 as I could see the column from where we want answer is in 5th column position
Which means 4 is the index position as ndra position starts from 0 for first column

So if needed make the change accordingly

Cheers @ashishmani

Hi @ashishmani,

@Palaniyappan has already helped you. Here is a summary and a slightly different approach

  1. Read excel
  2. Your excel does not have headers so ensure you read the excel without headers. Uncheck add headers
  3. Declare empty list to save unique names. Not using array as arrays are of predefined lengths.
  4. Use for each or for each row activities to get the name and save the name to the list in Step 3. Here I use the Invoke Method activity
  5. If the list now contains more than two names then you know there are multiple names in the excel.
  6. Your further logic after this classification

I tested this on two of your datadt.xlsx files.

GetNameFromExcelColumn.xaml (12.8 KB)
datadt.xlsx (8.1 KB)
datadt.xlsx (8.4 KB)

@jeevith and @Palaniyappan thank you so much.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.