0

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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

You can try to implement the functions you need in plain DataWeave o a a Java static method as an alternative.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.