Object reference not set to instance of an object for assign activity

I’m getting this error can anyone help ?

2 Likes

@Mayur_Pawar You cannot directly assign a DT to a String Variable

so how can i assign DT to string ?

@Mayur_Pawar , You need to Use Output Datatable Activity

Hi @Mayur_Pawar,

The NewDT variable is null. So before assign the value to StringContains check it is null or not like below.

Regards
Balamurugan.S

1 Like

Hi
It seems like the newDt variable has no value in it
Kindly check that once with the writeline activity with that variable passed as input
So that we can check whether the variable has value in it or not
Or if this occurs along the process we can do as @balupad14 suggested with a IF Condition validation
Cheers @Mayur_Pawar

1 Like

what if i want that string which i passed in output data table that to be use in if condition but error message cannot used string to boolean how can i do that ?

thanks
cheers :smile:

@Mayur_Pawar I guess You need to use String.IsNullorEmpty(StringContains) to check if it is empty or not

1 Like

thanks
cheers :smile:

what if i want to read 2 cell at a time ? let say i want to check A1:A1 and B1:B1 in same read range activity

@Mayur_Pawar There is Read Cell activity. But i dint Understand the Complete Question you have :sweat_smile:

1.let say in excel at A1:A1 range i have String called “ABC” or in B2:B2 range i have string called “XYZ” than only condition will satisfies and after that remaining execution of workflow.

  1. if i want to cross check value that is present in excel like at respetive cell “Name” but that will be dynamic value next time it may be change

this 2 i want to execute

i want to check whether that cell consists value or not before processing the exact workflow.

for example
let say i have 2 excel one consist of data and another one is blank so before going ahead i want to check whether that has data or not in any of the cell or in any particular cell

i want to check whether that cell consists value or not before processing the exact workflow.

for example
let say i have 2 excel one consist of data and another one is blank so before going ahead i want to check whether that has data or not in any of the cell or in any particular cell

Fine for that we can use READ CELL activity and get the output with a variable of type string named str_input
Then we can use IF condition like NOT String.IsNullOrEmpty(str_input.ToString

So if true meaning it has some value in it then would go for THEN part activity or goes to ELSE part of if condition

And for this

We can get the datatable or second excel named dt2
And pass that as input to OUTPUT DATATABLE activity and get the output variable of type string named str_output
—now use a IF condition like this
str_output.ToString.Contains(“keyword”)

if true meaning it has some value in it then would go for THEN part activity or goes to ELSE part of if condition
Cheers @Mayur_Pawar

1 Like

but read cell not returning any value it showing empty message box but if i used read range that it will showed

1 Like

hmm
read cell activity will actually work for a particular cell position
if possible can i have a screenshot of what mentioned in the READ CELL activity
@Mayur_Pawar

str_output.ToString.Contains(“keyword”) what if i just want to check whether that contain variable or not instead of passing any keyword over there , so for that what would be condition

1 Like

Yah like this
str_output.ToString.Contains(Yourvariable.ToString)
Cheers @Mayur_Pawar