Partial content check

Good day.
I have string “lalala”
In DT I have: lalaladpaf 182,a2[.29p;a
OR: lalala gjqkepijq

And i write
if row(0).ToString.Contains(“lalala”)

What I need write instead CONTAINS to get rows : lalaladpaf 182,a2[.29p;a (
where is my line present)

You can iterate over the rows containing “lalala” if you create a For Each activity (not a For Each Row) with the datatype set to System.Data.DataRow. You will need to iterate over DtData.Select("[ColumnName] LIKE '%lalala%'") to get the array of rows where your string is present, where DtData is your datatable, and ColumnName is the name of the column on which you’re searching.

1 Like

I don’t understood after FOR EACH.
Where I write: DtData.Select("[ColumnName] LIKE ‘%lalala%’")?

Where it says “For each [Field] in [Field]”, that expression goes in the 2nd field. DtData.Select("[ColumnName] LIKE '%lalala%'") will return an array of datarows to iterate over.

1 Like

How I need write, if I don’t have column name. It is row(0) column
And “lalala” - it is value - sdf

You can replace [ColumnName] with 0 in the string.

dt.Select(“0 LIKE %myVal%”)
??
It is not work

@RPA3 Can you Check with this Statement :
If you need the Array of rows matching the condition use this :
DT.AsEnumerable.Where(Function(x)x(0).ToString.ToLower.Contains(“lalala”)).ToArray

if you need the Datatable with rows having matching condition use this :
DT.AsEnumerable.Where(Function(x)x(0).ToString.ToLower.Contains(“lalala”)).CopyToDataTable

1 Like

Not i need value from dt’s row which exist myValue

@RPA3 Can you tell what value you need with an Example Value if possible?

For example DT:
123wqe1e
qwe12rer
q12124444444444444qqweq
dgerver
kt7uy53

I have myVal = “123”

And I check: if row(0).WHATWHERE(myVal) - I take row where it. It will be:123wqe1e

@RPA3 Will there be many rows or only One row for your condition?

If only one row you can use this :
dtRow = DT.AsEnumerable.Where(Function(x)x(0).ToString.ToLower.Contains(“lalala”)).ToArray(0)

where dtRow is a DataRow Type.

dtRow(0) will give you the valeu you need.

2 Likes

No, I have some rows this value, and I need go to all of them in for each row activity

@RPA3 What do you want to do after you have found the row you want, do you want to Update the other Columns or other operation or just Find those values and output it’s value?

There are sum. I sum theese
Take first sum,
also take second sum and sum first with second

My:

IF row(0).ToString.Contains(address)

sum = cdbl(row(1))
total sum - total sum + sum

But i needed NOT contains, a Partial content

help, please

@RPA3 Do you want to store the Sum in Excel or do you just want the Sum value to be computed ?

Please just write how I can use the action I ask about.
Contains checks for complete content, and I need partial