0
我輸入出生列的日期.csv
格式文件,其中包含字符串,例如字符串轉換爲日期Dataweave
Aug-03-2015
我想這個coloumn更改爲日期(如果不可能,那麼至少到另一個字符串)格式如下
03-08-2015
。 試用了RyanCarter建議的邏輯。我現在嘗試使用
Birthday:$.DOB as :date {format : "MMM-dd-yyyy"} as :string {format: "dd/MM/yyyy"}
其中DOB是.csv輸入中的字符串列。但我得到了下面的例外。
Message : Exception while executing:
DOB:$.DOB as :date {format : "MMM-dd-yyyy"} as :string {format: "dd/MM/yyyy"}
^
Cannot coerce a :string to a :date, caused by :Text 'NOV-03-1992' could not be parsed at index 0
Type : com.mulesoft.weave.mule.exception.WeaveExecutionException
Code : MULE_ERROR--2
********************************************************************************
Exception stack is:
1. Cannot coerce a :string to a :date, caused by :Text 'NOV-03-1992' could not be parsed at index 0
(com.mulesoft.weave.model.values.coercion.exception.UnsupportedTypeCoercionException)
com.mulesoft.weave.model.values.coercion.LocalDateTypeCoercionValue:30 (null)
2. Exception while executing:
DOB:$.DOB as :date {format : "MMM-dd-yyyy"} as :string {format: "dd/MM/yyyy"}
^
Cannot coerce a :string to a :date, caused by :Text 'NOV-03-1992' could not be parsed at index 0 (com.mulesoft.weave.mule.exception.WeaveExecutionException)
com.mulesoft.weave.mule.WeaveMessageProcessor$WeaveOutputHandler:166 (null)
********************************************************************************
Root Exception stack trace:
com.mulesoft.weave.model.values.coercion.exception.UnsupportedTypeCoercionException: Cannot coerce a :string to a :date, caused by :Text 'NOV-03-1992' could not be parsed at index 0
而不是使用「八月-03-2015」直接我試圖提取來自輸入元數據的值作爲$ .DOB,其中DOB是輸入中的列名稱。我收到了「無法強制a:字符串到a:date」錯誤。而不是在數據編織中編寫字符串,我如何從輸入中獲取值? –
它可能不是正確的格式。你可以發佈堆棧跟蹤與它試圖解析的日期嗎? –
在問題中添加了異常堆棧跟蹤。 –