Match 2 variables values with DB or Data table rows

Str_Commodity : I415 or D456 …etc… (this value will be captured from website)

Str_PurchOrg : [0001] HMP or [0001] HCP or 0005 or ADMI…etc… (this value will be captured from website)

Now bot has to match starting letter of commodity code and whole text of purg org with below DB and store the result as Yes or No based on the validation

Commodity PurchOrg
D [0001] HMP, 0002, 0005, 0007, 0009, 0010, 0012, EMS, PPRO
E, F, P, I, X, Y, Z, T 0013, PIND, 0004, 0008
D, E, F, P, I, X, Y, Z, T [0001] HCP, 0006, ADMI, HCGA, HCGW, HCIP, HCHK, HCIN, HCJB, IADM

Example :

Success Scenario : When Commodity is I415 and PurchOrg is PIND

Expected output “Yes”

Failure Scenario : When commodity is D456 and purchOrg is 0013

Expected output “No”

@Sathish_Kumar_S

use for each row in datatable activity
inside

use assign activity
arr_Commodity=Currentrow(“Commodity”).tostring.split(","C)

arr_PurchOrg=Currentrow(“PurchOrg”).tostring.split(","C)

if condition as
arr_Commodity.any(function(x) x.tostring.equals(Str_Commodity) and arr_PurchOrg.any(function(x) x.tostring.equals(“Str_PurchOrg”)

gives you boolean value

then

assign output as yes

else

assign output as no

cheers

We need to match only the first letter of Str_Commodity value with DB row… Will above code will work?

@Sathish_Kumar_S

small change
use for each row in datatable activity
inside use
Currentrow(“Commodity”).tostring.contains(Str_Commodity.substring(0,1)) and Currentrow(“PurchOrg”).tostring.contains(Str_PurchOrg)

then
assign yes

else
assign no

cheers

cheers

This is should be success case… but the output is “No”

How to break the loop once it is “Yes”?

All good… Thank you @Shiva_Nikhil

1 Like

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