How to use multiple lookup in single datatable

For ex: I have values like Orderno:101 and Quantity:3 . I need to find the values in above datatable and in result column need to mention"completed"

Hi @balanirmalkumar.s

You can use the LINQ Expression to update the Result column based on Conditions, Check the below Expression,

- Assign -> dt_Output = (From row In dt_Input
                         Let Result = If(row("Orderno").toString.equals("101") AndAlso row("Quantity").toString.equals("3"), "Completed", "")
                         Select dt_Input.Clone.Rows.Add({row("Orderno").toString, row("Quantity").toString, Result})
                               ).Copytodatatable()

dt_Input is the datatable variable where you have stored the above input data. The output is stored in dt_Output variable.

Hope it helps!!

1 Like

Hello @balanirmalkumar.s

You could use the .Select function on your database to filter the wanted result.

Assign dtrw_DataRow = dt_Orders.Select("[Orderno]='"+str_OrderNo+"' AND [Quantity]='"+str_Quantity"'").CopyToDatatable.Rows(0)

Regards
Soren

How to get row index. Need to update result column using write cell activity.

No need to get row index and all for this… @balanirmalkumar.s

β†’ Use the Read range workbook or Read range activity to read the excel and store in a datatable called dt_Input.
β†’ Then use the assign activity and write the LINQ Expression which I have given in the above post.
β†’ After assign use the write range workbook activity to write the dt_Output updated datatable to same excel file.

Hope you understand!!

@balanirmalkumar.s

You can try this to get the row number

dt.Rows.IndexOf(dt.AsEnumerable.Where(function(x) x("orderno").ToSTring.Equals(Ordernovariable) AndAlso x("quantity").ToSTring.Equals(qtyvariable)).FirstOrDefault)

cheers

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