Compare part of the string (Changes each of the time) and rest of the string stays as it is

I want to compare some data coming from Database.

Database Data : 123456
Compare With File NAme : File123456 xyz.pdf

So from above to lines I have to check if numbers from Database are there in the File Name (At specific space)?

Thanks in Advanced

String.contains method so you should compare like this: filename.contains("12345")

There is a handful of useful methods in the String class, suggested reading:
String Class (System) | Microsoft Docs

Can you show me exact example. I mean I have to go and find particular file from some shared location. How should I apply this?

So, assuming you have a variable “filename” where you have the filename stored, use an if activity to compare. where “123456” is the value you retrieved from the database.


Thanks but how should I compare the value of data table to this ?

I am using For each row to get the data from Filter data table.
Then, using for each file in directory.getfiles(“abc Location”).


I understand you are looking for something like this. You can review and return.

I hope it helps.

SimpleExample.xaml (11.8 KB)


Thanks for sharing.

Can you elaborate more on each step.
What is 1st and 2nd build DT , Assign is for ?

Also I am not able to get last activity you used. Do I need to install any package?


Make sure your UiPath.System.Activities package is up to date.

You can think of table 1 as your own table from the database. In your setup, there will be a sql query here and it will give you a datatable.

Table 2 is a table created to make comparisons.

In the first assign, the fileList array is defined. It asks for the files you want to compare, you can update the filepath field here.

The second assign also transforms this arraylist into a datatable.

Now we have both the table in the database and the table of the files you want to compare. There is a loop in the field that you don’t see, and it compares your file table for each of your database rows and creates a table for the ones that match.

I will try and let you inform if need any help. Thank You @muhammedyuzuak