If activity and send outlook mail message activity error

I did data extraction (variable-dt_datatable) and filter data in that i have used dt_datatable variable and filtered data table have used io_dt_CourseRecords so then new xml i have used if condition to send mail assigned task and not assigned task as per filtered column so in if condition i have used as condition as io_dt_CourseRecords.Rows.Count > 0 then in the then block i taken outlook mail message activity to send list of assigned task and in else block i have used send outlook mail message to send mail regarding no task assigned ,i did this but its showing error as If-To send mail Assigned and No Assigned Courses: Object reference not set to an instance of an object. for outlook activity ;how to remove this error

@pallavi_patil2

as per error some variable you are using is not intialized or is null

check the locals panel for all values when this error occurs

cheers

Hi, If after extraction there is nothing(no rows/columns) in your data table then the condition you are using i.e datatable.rows,count>0 will fail as your datatable is nothing/not initialized. Instead you would have to first check if ‘datatable isnot nothing’ if true then then check dt.rows.count>0 condition an then send mail. if condition datatable isnot nothing is false then probably throw exception as it has no value. Hope this helps

@pallavi_patil2,

Try this expression in If activity Condition.

dt Is Nothing OrElse Dt.Rows.Count = 0

If this condition is true, it means there is no data in the datatable or there are zero rows.

Thanks,
Ashok :slight_smile: