800-596-4880 ](tel:1-800-596-4880)

Online  [ Contact Us ](https://www.mulesoft.com/contact)

  * Login 

[ Anypoint Platform
](https://anypoint.mulesoft.com/login/#/signin?apintent=generic) [ Composer
](https://composer.mulesoft.com/login/sign-in) [ Training
](https://training.mulesoft.com/login) [ Help Center
](https://help.mulesoft.com/s/login/)

[ Free trial ](https://anypoint.mulesoft.com/login/#/signup?apintent=generic)

[ Link to MuleSoft Twitter profile  ](https://twitter.com/MuleSoft) [ Link to
MuleSoft Linkedin profile  ](https://www.linkedin.com/company/mulesoft) [ Link
to MuleSoft Facebook page  ](https://www.facebook.com/MuleSoft) [ Link to
MuleSoft Instagram profile  ](https://www.instagram.com/mulesoft/) [ Link to
MuleSoft Videos platform  ](https://videos.mulesoft.com/) [ Link to MuleSoft
Twitch profile  ](https://www.twitch.tv/mulesoft_community)

© Copyright 2024  Salesforce, Inc. [ All rights reserved
](https://www.salesforce.com/company/legal/intellectual/) .

![](../../_/img/icons/arrow-down.svg)

Skip to main content

[ View on GitHub ](https://github.com/mulesoft/docs-
dataweave/blob/v2.6/modules/ROOT/pages/dw-runtime-functions-eval.adoc)

#  On this page:

Menu

  1. [ Homepage  ](../../general/)
  2. [ DataWeave (2.6) ](./)
  3. [ DataWeave Reference ](dw-functions)
  4. [ dw::Runtime ](dw-runtime)
  5. eval 

![](../../_/img/icons/arrow-down.svg) ![](../../_/img/icons/search.svg)

  1. [ Homepage  ](../../general/)
  2. [ DataWeave (2.6) ](./)
  3. [ DataWeave Reference ](dw-functions)
  4. [ dw::Runtime ](dw-runtime)
  5. eval 

#  eval

##  eval(fileToExecute: String, fs: Dictionary<String>, readerInputs: Dictionary<ReaderInput> = {}, inputValues: Dictionary<Any> = {}, configuration: RuntimeExecutionConfiguration = {}): EvalSuccess | ExecutionFailure 

Evaluates a script with the specified context and returns the result of that
evaluation.

_Experimental:_ This function is an experimental feature that is subject to
change or removal from future versions of DataWeave.

###  Parameters

Name  |  Description   
---|---  
` fileToExecute ` |  Name of the file to execute.   
` fs ` |  An object that contains the file to evaluate.   
` readerInputs ` |  Reader inputs to bind.   
` inputValues ` |  Additional literal values to bind   
` configuration ` |  The runtime configuration.   
  
###  Example

This example shows how ` eval ` behaves with different inputs.

####  Source

    
    
    %dw 2.0
    import * from dw::Runtime
    
    var jsonValue = {
       value: '{"name": "Mariano"}' as Binary {encoding: "UTF-8"},
       encoding: "UTF-8",
       properties: {},
       mimeType: "application/json"
    }
    
    var jsonValue2 = {
       value: '{"name": "Mariano", "lastName": "achaval"}' as Binary {encoding: "UTF-8"},
       encoding: "UTF-8",
       properties: {},
       mimeType: "application/json"
    }
    
    var invalidJsonValue = {
       value: '{"name": "Mariano' as Binary {encoding: "UTF-8"},
       encoding: "UTF-8",
       properties: {},
       mimeType: "application/json"
    }
    
    var Utils = "fun sum(a,b) = a +b"
    output application/json
    ---
    {
       "execute_ok" : run("main.dwl", {"main.dwl": "{a: 1}"}, {"payload": jsonValue }),
       "logs" : do {
         var execResult = run("main.dwl", {"main.dwl": "{a: log(1)}"}, {"payload": jsonValue })
         ---
         {
             m: execResult.logs.message,
             l: execResult.logs.level
         }
       },
       "grant" : eval("main.dwl", {"main.dwl": "{a: readUrl(`http://google.com`)}"}, {"payload": jsonValue }, {},{ securityManager: (grant, args) -> false }),
       "library" : eval("main.dwl", {"main.dwl": "Utils::sum(1,2)", "/Utils.dwl": Utils }, {"payload": jsonValue }),
       "timeout" : eval("main.dwl", {"main.dwl": "(1 to 1000000000000) map \$ + 1" }, {"payload": jsonValue }, {},{timeOut: 2}).success,
       "execFail" : eval("main.dwl", {"main.dwl": "dw::Runtime::fail('My Bad')" }, {"payload":