Filling missing values in Excel

@aamir

I think your first value 18098 is stored as a double value and that might be in this format ddMMyyyy
So better check it once by converting that to text in excel.

Regards,
Mahesh

1 Like

GL1.xls (1.9 MB)
This is the attached File.

1 Like

Hi Mahesh,

My first value i think its text only i have attached the excel. Please take a look into it.

1 Like

@aamir, for this type you can convert using

DateTime.FromOADate(Convert.ToDouble(row(“ColumnName”).ToString)

1 Like

Hi Dominic,

where i need to convert in my code can i share my code with you?

1 Like

@aamir
I think that is not the pblem

Regards,
Mahesh

1 Like

Main.xaml (63.1 KB)
Please check the Hdfc Ledger Sequence.

1 Like

@aamir

while assigning value to row(“Date”) give your expression.Tostring(“dd/MM/yyyy”)
Even for str_PrevDate first convert the value to datetime and then assign the value as string like .Tostring(“dd/MM/yyyy”)

Regards,
Mahesh

1 Like

Hi Mahesh,

I didnt get exactly where i need to change i have changed at certain places but ia m not getting the desired result.

1 Like

@aamir

Inside foreach row,
1.If the string is not empty you are assigning that to strPre_date. so convert the row(Date) to datetime and then to .Tostring(“dd/MM/yyyy”)
2.One more in if the string contains("") there give.ToString(“dd/MM/yyyy”

Regards,
Mahesh

1 Like

Hi Mahesh,

Getting an error convert.ToString(convert.ToDateTime(row(“Date”)))
Assign : Invalid cast from ‘Double’ to ‘DateTime’.

1 Like

Hi arivi,

Any update on this?

1 Like

sorry arivu

1 Like

@aamir

ok Do like this if the string is empty

before checking whether the string is containing(“/”) convert that to datetime and .Tostring(“dd/MM/yyyy”)

Regards,
Mahesh

1 Like

Hi Mahesh,

apart from this in the frst row i am getting the value 19-07-1949
instead of 18098.

1 Like

@aamir

Yes, “19-07-1949” is in datetime format

Regards,
Mahesh

Hi Mahesh,

I have converted it like this convert.ToDateTime(str_PrevDate).ToString(“dd/MM/yyyy”).Contains(“/”) but its throwing an error String was not recognized as a valid DateTime.

Hi @aamir ,

In IF Condition
str_PrevDate.Contains("/") In else condition use

Assign activity
row("Date")=DateTime.FromOADate(Convert.ToDouble(str_PrevDate))

Regards,
Arivu

Hi Arivu,

the code returns the following data again
19-07-1949
04-03-2017
03-04-2017
03-04-2017
03-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-04-2017
04-05-2017
05-04-2017
05-04-2017
04-06-2017

yes you asked like that only right??