Extract list indexes

Hello friends,
@rkelchuri, @Ninett_Panfir, @Rammohan91, @balupad14, @Florent_Salendres, @vvaidya, @Palaniyappan, @loginerror, @MAHESH1

image
how to extract a list of indexes?
ExtractDataTable.Rows.IndexOf( ExtractDataTable.Select("[Column-4]=’"+row(“Data_richiesta”).ToString+"’ AND [Column-6]=’"+row(“Data_scadenza”).ToString+"’ ")(0))
Not only the first one.
Thank you,
Cami

1 Like

Hi cami
–hope these steps would help you resolve this
–use a excel application scope and pass the file path as input
–inside the scope use a Read range activity and get the output with a variable of type datatable named dt
–now use a for each row loop and pass the above variable as input
–inside the loop use a if condition like this
row(“yourcolumnname1”).ToString.Equals(“yourvalue”) AND row(“yourcolumnname2”).ToString.Equals(“yourvalue”)
if this true it will go to THEN part where we can use a ADD TO COLLECTIONS activity
–in that activity property panel mention the variable list_rowindex of type System.Collections.Generic.list(of integer) with default value as New List(of integer) defined in the variable, to the property collections and in the items mention this
dt.Rows.IndexOf(row)
and change the type argument as int32

–so the variable list_rowindex know will be having the rowindex of matching condition - rows

Kindly try this and let know for any queries or clarification
Cheers @CamiCat

Cna you please share a xaml?Thank you
cami

@CamiCat

Try below Query.

dta - DataTable
dtb- DataTable
ListIndexes- List(Of String)- contains Row Indexes.

 ListIndexes= (From p In dta.Select
                      Where(From q In dtb.Select
                                      Where Convert.ToString(q("Data_richiesta")).Equals(Convert.ToString(p("Column-4"))) and Convert.ToString(q("Data_scadenza")).Equals(Convert.ToString(p("Column-6")))
                                      Select q).Count>0
              Select Convert.ToString(dta.Rows.IndexOf( p))).ToList

Regards,
Mahesh

1 Like

Thank you so much @MAHESH1,

I’ll try and let you know as soon as possible.
Cami

Sorry for the question @MAHESH1.
Which are the two datatables dta and dtb?
Thank you so much,
Cami :slight_smile:

@CamiCat

dta= ExtractDataTable
dtb= You are using row right. dtb is the datatable in which you are looping.

Regards,
Mahesh

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