Match only first 2 values of variable with DB

Str_CompanyCode : 4001 or 8551 or 8561…etc (this value will be captured from website)

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

Now bot has to check if Str_CompanyCode is starting with 40 or 85 then the Str_PurchOrg should have PIND and match with below DB rows and pass output as Yes else No

If Str_CompanyCode is OTHER than starting with 40 or 85 then Str_PurchOrg can be any value and output value will be Yes

Note : If above logic can be achieved without referring DB. Please suggest the logic

DB :

CompanyCode PurchOrg
40 PIND
85 PIND

Example :

Success 1 : When Str_CompanyCode is 4001 and PurchOrg is PIND

Success 2 : When Str_CompanyCode is 5001 and PurchOrg is HCP

Failure : When Str_CompanyCode is 4001 and purchOrg is [0001] HMP or any value (Except PIND)

@Sathish_Kumar_S

hi

use for each row in datatable activity
inside use
Currentrow(“CompanyCode”).tostring.contains(Str_CompanyCode.substring(0,2)) and Currentrow(“PurchOrg”).tostring.contains(Str_PurchOrg)

Then

assign yes

else

assign no

OR If Str_CompanyCode is OTHER than starting with 40 or 85 then Str_PurchOrg can be any value and output value will be Yes

How to achieve above logic?

@Sathish_Kumar_S

cint(Str_CompanyCode.substring(0,2)).equals(40) or cint(Str_CompanyCode.substring(0,2)).equals(85)

then assign
no

else
assign Yes

or you can try with below condition

Not (Str_CompanyCode.StartsWith(“40”) Or Str_CompanyCode.StartsWith(“85”))

then assign
Yes

else assign
No

Let me give the logic again

Success Scenario:

if Str_CompanyCode is starting with 40 or 85 then Str_PurchOrg should be = "PIND " OR if Str_CompanyCode is NOT starting with 40 or 85 then Str_PurchOrg = Any Value

Then expected output is “Yes”

Failure Scenario :

if Str_CompanyCode is starting with 40 or 85 then Str_PurchOrg = Any Value

Then expected output is “No”

@Sathish_Kumar_S

if-1 condition as

Str_CompanyCode.StartsWith(“40”) Or Str_CompanyCode.StartsWith(“85”)

then use another if-2
condition as Str_PurchOrg = "PIND "
then
assign “yes”
else

in else part of if-1

assign=“No”

1 Like

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