How to match the variable value in excel sheet

I have a excel sheet which has table as below



if my input variable is contains the same value as the data table i should throw business exception

For example:
Input argument value is GH

since GH is present in excel throw business exception

Hi @sruthesanju ,

Could you Check with the below Expression :


Here, DT is your Input Excel sheet datatable. The above expression you could directly use it in an If Activity. In then Block you could use the Throw Activity.

Hi @sruthesanju

  1. Use Read Range activity → Store it in DtRead

  2. Use Fore each row in data table activity

  3. If activity


Then → Use Throw activity → New BusinessRuleException("Your data")

Else → You can do your automation


Instead of excel what if the values are added in assert

@sruthesanju Use get asset activity and use the value of asset inside the code. Inside if
Assetvalue.Trim.contains(“GH”) then throw business exception.

It will have value as AB,CD ,EF,GH will contains works can you suggest me any other method

@sruthesanju If the value in AB,CD ,EF,GH in single asset
1.Use get asset activity to get asset value
2.Assign ArrayAsset=Assetvalue.split(“,”)
For each item in array
check if Inputvalue.Trim.Contains(item) then throw business exception

Hi @sruthesanju

In the Asset You can store the value like this AB,CD ,EF,GH

You can try with If activity and followed by below expression

(From d In DTInput1.AsEnumerable
Let b="GF"
Where Assetval.ToString.Trim.Contains(b)
Select d).any



I am getting this error in if condition

Have you tried with this expression ? @sruthesanju

will not be having any excel

Hi @sruthesanju

Okay Just Create the dummy data table using Build data table activity and check the above expression


Hi @sruthesanju

Try with this expression with out using excel Dt

(From d In Assetval.AsEnumerable
Let b="GF"
Where d.ToString.Trim.Equals(b)
Select d).any


If the value is available in asset also it not through business exception

Hi @sruthesanju

Check out this XAML file

AssetException.xaml (7.4 KB)


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