Home > Blockchain >  Azure Data Factory Case Condition for date
Azure Data Factory Case Condition for date

Time:02-15

I have column date in txt fil in Azure Blob Storage like this:

00000000
00000000
20120104
00000000
20111122
00000000

the 20120104 is mean 2012-01-04.

I have to transformation this column with derived column and using some logic: IF 00000000 then change with NULL. I have some expression in derived column like this:

iif({Entry Date} == '00000000', toString(null()), coalesce(toDate({Entry Date},'yyyyMMdd')))

or i try

iif({Entry Date} == '00000000', toString(null()), coalesce(soString(toDate({Entry Date},'yyyyMMdd'))))

but after Data Review, the result everthing is NULL. Big many thanks to have answer the question. Thanks,

CodePudding user response:

You can also use case() expression in derived column as below

case(toString(date)=='0', toString(null()),concat(substring(toString(date),1,4),'-', substring(toString(date),5,2),'-', substring(toString(date),7,2)))

enter image description here

  • Related