Hi! I have check excel file:
art.Contains(“art”) And model.Contains(“model”) And cost.Contains(“price”) And mass.Contains(“mass”) And sklad.Contains(“wert”) And cell.Contains(“cell”)
Then I have decision, if true - it works. But if false - I have this error:
VisualBasicValue: Object reference not set to an instance of an object.
From memory, I believe doing a .Contains on a null String will cause this error, so it may be worth check whether the Variables are null/not populated beforehand:
If String.IsNullOrWhiteSpace(art) Then
Throw - “Variable art is not initialised or not populated.”
So before this Expression , Please check if all the Objects are initialized and are not null as shown below.
Take an IF and Write the below Expression and in the true part mention your Expression
String.IsNullOrEmpty(art) and String.IsNullOrEmpty(model) and String.IsNullOrEmpty(Cost)
hello guys,
i’m facing a similar problem
i’ve string = “row(0).ToString.Contains(”“ABC”“)” and i’ve pass this in if condition to evaluate and give me true or flase
do we have equivalent of Eval() or Evaluate() in UiPath.
Since your Expression is full of AND, @mukeshkala suggested to do the null checking first before executing yours.
However I think that it should be NOT ( String.IsNullOrEmpty(art) OR String.IsNullOrEmpty(model) OR String.IsNullOrEmpty(Cost))
If = True, then you perform your Condition
You can combine the null checking to your Expression but will make your Expression very long.
Take note that you should use AndAlso. Some people implements it using Invoke Code.
ex: (not String.IsNullOrEmpty(art) AndAlso art.ToString.Contains("art")) AND (not String.IsNullOrEmpty(model) AndAlso model.ToString.Contains("model")) AND (not String.IsNullOrEmpty(Cost) AndAlso model.ToString.Contains("Cost"))
etc
Stick to your existing implementation, and just Surround with Try Catch
so that if there is an Exception, you can still perform the False activity in the Catch section.