ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 166 - MCD - Level 1 discussion

Report
Export

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]')
Answers
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]')
Answers
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]')
Answers
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]')
Answers
D.
1. 1. import * from libs::etl::WebStore 2. 2. --- 3. 3. loginUser('[email protected]')
Suggested answer: D

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:

asked 18/09/2024
Nicolas Pintrel
35 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first