In the Azure Data Factory data mapping flow, is there a way to check if a column Date
exists in the input file? If true
, select the Date
column, if not then create a Date
column but leave the column blank in the output?
I tried with conditional select
that if name=='Date'
, name the column as Date
, but it the workflow fail with the "Date" column doesn't exist.
You can use byName()
in the derived column transformation.
This is my sample input data with Date
column.
In derived column, use the below dataflow expression.
toDate(byName('Date'))
The above byName()
will search for the given column name and if it is there in the columns list then it gives those values and if it not there it will give null values to the column.
Result when Date column present in source:
Source without Date
column:
Result with Date
column and values as NULL
:
After derived column transformation, use select transformation to select your desired columns.