How to skip saving null field date column in access from data table

OBJECTIVE: to skip saving empty field date from data table to access

TABLE (COLUMN): dt_Original_Sheet (CreatedDate, ReceivedDate)

SAMPLE RECORD:

CreatedDate|ReceivedDate
|01/02/2023|01/05/2023|
|03/25/2023|03/26/2023|
|02/22/2023||
|01/05/2023|02/01/2023|

ACTIVITY USED UPON SAVING: Insert Activity
ERROR: Insert: Failed to convert parameter value from a String to a DateTime.

Hey @arthurang
You can check in if conition
row(“ReceivedDate”).Equals(String.Empty)
IN true do noting else do the operation you want (convert the parameter.)

Hi @Chirag_Shetty_Divakar thanks for your reply. i’m new to UiPath and i’m not quite sure where will i put that code since i’m using Insert Activity to insert all data came from the data table.

Hey @arthurang

Date Forum.zip (68.7 KB)

Hope this might help you mate
Cheers.

Hi @arthurang ,

The Objective might need to be cleared as there is a confusion.

Do you want to remove the rows which has Empty field value in the Datatable and then Insert the filtered Datatable ?

or

Do you want the Access DB to accept these rows which also have empty field values ?

Hi @supermanPunch apologies. the objective is to skip only the date field that is empty in data table since the field in access database was set as date/time.

Hey @arthurang ,

You can use filter datatable activity to remove the empty rows.
You can go through this link for a better understanding.

https://docs.uipath.com/activities/lang-ru/docs/build-and-filter-data-table

Thanks,
Sanjit

@arthurang ,

So we can conclude that you would want the 3rd Row’s First column value to be inserted but not the second column value, Is that right ?

already got the solution. thanks to @vishal.kp and to everyone who give their answer also. :slight_smile:

dtTable.AsEnumerable.ToList.ForEach(Sub(row)
	If(IsNothing(row("ReceivedDate")) Or (String.IsNullOrEmpty(row("ReceivedDate").tostring.Trim))) Then
	row("ReceivedDate") = DBNull.Value
	End If
End Sub)
2 Likes

Happy automation! @arthurang

1 Like

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