How to get specific product

Hi I have an input file which has 5 columns

Acc,Pack,Pack1,Srv,OTC,
1234667,MP22L500,HmPh,3030,7000
1234567,MP22M500,3015,7001

I am not able to figure out how to get bot working on the condition that if input has hmph then it is suppose to click it but there is no input then do not look for it and proceed.

Can anyone suggest how to proceed

Hi @dipon1112000

  1. Read Input File and stored in variable DT as Data Table.
  • Try below expression in IF Activity Condition. It’ll return True or False

DT.AsEnumerable.Any(Function(row) row.ItemArray.Any(Function(cell) cell.ToString.ToLower.Equals("hmph"))

Hope it will helps you :slight_smile:
Cheers!!

@dipon1112000

What is to be clicked?

If you need only hmph rows then first use a filter datatable and filter the required column with hmph then only those rows aould come

Cheers

Hi thank for helping, I have tried “IF”
Condition=Pack1.Condition(“HMPH”) it worked but but I have input as

Acc,Pack,Pack1,Srv,OTC,
1234667,MP22L500,HmPh,3030,7000,
1234567,MP22M500,3015,7001,
1234568,MP22S500,HMPHPS,3015,7001,

My script is not recognising HMPHPS as it’s not mentioned in the Condition

I am not sure how to get it added to condition

Hi @dipon1112000 ,

Instead of “Equals” use “Contains” as below

Input_Dt.AsEnumerable.Any(Function(row) row.ItemArray.Any(Function(cell) cell.ToString.ToLower.Contains("hmph")))

Regards,
Vinit Mhatre

Hi thank you for helping but I have requirement to pick both hmph and hmphps

For example

If Pack1 contains hmph then the script should pick hmph and if Pack1 contains hmphps then script should pick hmphps

1 Like

Hi @dipon1112000 ,

You can use “Or” operator

Input_Dt.AsEnumerable.Any(Function(row) row.ItemArray.Any(Function(cell) cell.ToString.ToLower.Contains("hmph") Or cell.ToString.ToLower.Contains("hmphps")))

Regards,
Vinit Mhatre

Hi,

try as below:-

DT.AsEnumerable.Any(Function(row) row.ItemArray.Any(Function(cell) cell.ToString.ToLower.Contains(“hmph”) Or cell.ToString.ToLower.Contains(“hmphps”)))

If this works for you, please mark this as a solution, for others reference. :slight_smile:
Thanks

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