nerdexam
MuleSoft

MCD-LEVEL-1 · Question #174

A Mule project contains a DataWeave module like WebStore.dwl that defines a function named loginUser. The module file is located in the project's src/main/resources/libs/etl folder. What is correct…

The correct answer is D. 1. import * from libs::etl::WebStore 2. --- 3. loginUser("[email protected]"). To use custom modules, you need to import the module or functions you want to use by adding the import directive to the head of your DataWeave script, for example: 1) Does not identify any functions to import from the String module: import dw::core::Strings 2) To identify a…

Use DataWeave to transform data

Question

A Mule project contains a DataWeave module like WebStore.dwl that defines a function named loginUser. The module file is located in the project's src/main/resources/libs/etl folder. What is correct DataWeave code to import all of the WebStore.dwl file's functions and then call the loginUser function for the login "[email protected]"? A. 1. 1. import libs.etl 2. 2. --- 3. 3. WebStore.loginUser("[email protected]") B. 1. 1. import * from libs::etl 2. 2. --- 3. 3. WebStore::loginUser("[email protected]") C. 1. 1. import libs.etl.WebStore 2. 2. --- 3. 3. loginUser("[email protected]") D. 1. 1. import * from libs::etl::WebStore 2. 2. --- 3. 3. loginUser("[email protected]")

Options

How the community answered

(44 responses)
  • A
    11% (5)
  • B
    2% (1)
  • C
    7% (3)
  • D
    80% (35)

Explanation

  • To use custom modules, you need to import the module or functions you want to use by adding the import directive to the head of your DataWeave script, for example: 1) Does not identify any functions to import from the String module: import dw::core::Strings 2) To identify a specific function to import from the String module: import camelize, capitalize from dw::core::Strings 3) To import all functions from the String module: import * from dw::core::Strings The way you import a module impacts the way you need to call its functions from a DataWeave script. If the directive does not list specific functions to import or use * from to import all functions from a function module, you need to specify the module when you call the function from your script. * In given scenario, it's mentioned to import all of the WebStore.dwl So correct answer is:

Topics

#DataWeave#module import#custom DWL#function call syntax

Community Discussion

No community discussion yet for this question.

Full MCD-LEVEL-1 Practice