Version

    Parameters with CTL Expressions (Dynamic Parameters)

    Since of CloverETL 4.0.0-M2, you can also use CTL2 expression in parameters. The CTL2 expression has to return a string data type.

    Example 36.2. Dynamic graph parameters - usage of CTL2 as a graph parameter value

    //#CTL2
    
    function string getValue() {
        return date2str(today(), "YYYY-MM-dd HH:mm:ss");
    }

    To assign CTL2 code to a graph parameter, use the Edit Parameter CTL2 Value dialog.

    [Note]Note

    Earlier versions of CloverDX than 4-0-0-M2 employed a today deprecated CTL1 expressions to assign a dynamic value to graph parameters:

    Since the version 2.8.0 of CloverDX, you could use CTL expressions in parameters and other places of CloverDX. Such CTL expressions can use any possibilities of CTL language. However, these CTL expressions had to be surrounded by back quotes.

    For example, if you defined a parameter TODAY="`today()`" and used it in your CTL codes, such ${TODAY} expression would be resolved to the current day.

    If you want to display a back quote as is, you must precede the back quote by a back slash as follows: \`.

    The usage of CTL1 is now deprecated!

    Time of Evaluation

    If you design long-running graph, you may need to know, when dynamic parameters are evaluated.

    Exact point of evaluation of graph parameter depends on way of an access to the parameter.

    If you access the parameter using getParamValue(), dynamic parameters are evaluated each time the getParamValue() function is called. You can use this approach e.g. to make a timestamp of particular record processing.

    If you access a parameter value using ${PARAMETER_NAME}, the parameter value is evaluated once during initialization. Note that the parameter can be initialized in different places on different time.