Support Questions

Find answers, ask questions, and share your expertise

nifi expression value for null and datetime

avatar
Contributor

I have created data flow which will transfer SQL server data from DB to DB in nifi and there a datetime column and it also contains some null value in source table, now i want to transfer that column with datetime value and also null values same time to the datetime column in target table. I'm unable to find right expression to put it in update attributes processor.

I'm using below expression in update process:

sql.args.1.name : CR_LINE_CMTD_START_DT

sql.args.1.type : 93

sql.args.1.value :${CR_LINE_CMTD_START_DT:toDate("yyyy-MM-dd HH:mm:ss.SSS"):toNumber()}

Please help to fix this

Thanks sam

,

Hi I have created data flow which will transfer SQL server data from DB to DB in nifi and there a datetime column and it also contains some null value in source table, now i want to transfer that column with datetime value and also null values same time to the datetime column in target table. I'm unable to find right expression to put it in update attributes processor.

I'm using below expression in update process:

sql.args.1.name : CR_LINE_CMTD_START_DT

sql.args.1.type : 93

sql.args.1.value :${CR_LINE_CMTD_START_DT:toDate("yyyy-MM-dd HH:mm:ss.SSS"):toNumber()}

Please help to fix this

Thanks

sam

3 REPLIES 3

avatar
Expert Contributor

@Ravi Teja did you try this ? it worked for me

${CR_LINE_CMTD_START_DT:toDate("yyyyMMddHHmmss"):format("yyyy-MM-dd HH:mm:ss")}

avatar
New Contributor

Could you send a screenshot of your data flow to give us a better idea of what you have implemented? You may have to pull the field down as just a string, check for null in a RouteOnAttribute, and then modify the insert command to a date of your choosing or "" if you wish for it to remain null. For non-null you can format as needed and then direct both branches into a putsql processor to be inserted.

avatar
New Contributor