How to search for strings in variable positions

Hi to all,
I am dealing with a use case that requires the identification of an element on an excel sheet, and the search for the same on another excel sheet.

I have complications, as the position is variable.

The trigger file contains a cell with this type of daa:

_Number fidejussione : 01383-8200-00737432 _Date fid : 20180926

The item I need to take is the highlighted number: 00737432.

I need to figure out if it is present in another excel sheet that contains a string with another format:
03000/01000/8200/00737432/3015/2018 000000505050

To complicate the work, it must be considered that this data, in this second file, is not always in the same position.
In the example above, the number 00737432 is after the third /, but in other rows of the excel sheet the number is after the second.

I would need help both to collect the data and to search for it.
On the source file, I know that this data is related to the surety number, and is found in the string:
_Number fidejussione : 01383-8200- 00737432 _Date fid : 20180926
and before the ā€œ_dateā€

I donā€™t know how to search for this element, in a string with a variable position.
03000/01000/8200/00737432/3015/2018 000000505050

Can anyone help me with this?
tks
Aaron

Hi @AaronMark,

Iā€™m not entirely sure if I understood your question correctly but if you can get the String from file1 that you need to search from file2, you just need to use Regular Expressions in order to test a String against it regardless of itā€™s position.

The steps would probably be something like this:

  1. Get String from file1 that you need to use to search in file2
    wera

  2. While going thru (iterating) values in file2, you can use ā€œIs Matchā€ activity to test each string if it maches what youā€™re looking for.
    image


    image

Hope that helps.

Disclaimer: Screenshot might not be exactly what you need. But just to give you an idea.

Alternative solution if regular expressions are not your thingā€¦

say your (2nd) ā€˜sourceā€™ is 123/345/678/3173/633265
And the values can be in different positions as you mention.

Use this statement: Assign: myValues = source.split("/"c)
With myValues as an array(of String)

The split will separate the values in the array based on the / character.

Next you can iterate through the array with a ā€˜for eachā€™ item in myValues, where you can evaluate each item until you find your key value.

1 Like

Yeah with the same approach as suggested by @Jeroen_van_Loon, just after splitting the string with ā€˜/ā€™ and added to the array, just use the resultArray.Contains(ā€œYourStringā€).

Ok ā€¦ I take some time to understand the instructions and do some tests.
Iā€™m not very experienced in programming.
I get along with simple automation projects, but when I have to use manipulated strings, Iā€™m weak.

To get a general picture of the work, it is a question of verifying whether the payments notified by the bank are correct.
The bank provides me with an xlsx or csv with one format,
but the comparison table has conditions written in a different format.

Thanksā€¦ to allā€¦