jason44107
jason44107

Reputation: 473

Mulesoft Dataweave: can import Strings but not Dates

I have a Mule application project in which I'm able to import dw::core::Strings but unable to import dw::core::Dates. To reduce the problem to a small example, I have a Transform Message block which sets an output variable to this:

%dw 2.0
import * from dw::core::Strings
import * from dw::core::Dates
output application/json
---
leftPad('Code', 9, 'M')

When I try to debug this application, execution fails at that block with this error:

""Script '%dw 2.0
import * from dw::core::Strings
import * from dw::core::Dates
output application/json
---
leftPad('Code', 9, 'M')
 ' has errors: 
    Unable to resolve module with identifier dw::core::Dates. at 3 : 3" evaluating expression: "%dw 2.0
import * from dw::core::Strings
import * from dw::core::Dates
output application/json
---
leftPad('Code', 9, 'M')
"."

If I remove the line about importing dw::core::Dates, then the block executes with no error and is able to call the leftPad method imported from Strings.

I know I don't have any calls to Dates methods in this example. I will add those once I'm able to import dw::core::Dates without an error. How do I get it to resolve and import the Dates module?

I'm using Anypoint Studio version 7.9.0 with Mule Server 4.3.0 EE. Thank you.

Upvotes: 0

Views: 1016

Answers (1)

aled
aled

Reputation: 25802

dw::core::Dates was introduced in Mule 4.4 with DataWeave 2.4.0. It is not present in Mule 4.3 which includes DataWeave 2.3.0. The only solution is to upgrade the version of Mule.

Upvotes: 3

Related Questions