Customer Portal

Change value for parameters using reformat component

Comments 4

  • Avatar
    admin
    0
    Comment actions Permalink
    Hi chaitanya_r,

    Changing/adding parameters using CTL2 during run time is not supported because it is potentially dangerous. When modified parameter is used somewhere in graph, it may behave nondeterministically (it would behave differently when CTL code was executed before launching component or not).

    For passing parameters to subgraphs is best possibility component http://doc.cloveretl.com/documentation/ ... graph.html which allows you to pass parameters or set dictionary entries. This functionality is available only in commercial CloverETL Server Corporate+.
  • Avatar
    chaitanya_r
    0
    Comment actions Permalink
    Thanks, but from the guide I came to know that we have code to add/replace parameters, so clover is allowing to change the parameter values. But when I tried to use the function getGraph() in my component it says the method is not available:

    Properties may be added or replaced like this:
    getGraph().getGraphProperties().setProperty("newProperty", value );
  • Avatar
    dpavlis
    0
    Comment actions Permalink
    If you need to share some "parameters" among components of graph or across graphs and you need to change the values dynamically (say in a Reformat), use Clover's dictionary. That is sort of dynamic lookup table (with typed values).

    See the CTL documentation: Clover Dictionary.

    Basically, you access dictionary as a dynamic record: dictionary.<dictionary entry>

    It may appear on both sides of assignment expression (actually any expression):
    dictionary.<dictionary entry> = <value>;
    <variable> = dictionary.<dictionary entry>;


    Example:
    dictionary.customer = "John";

    if (dictionary.customer == "John") print_err("It was John");


    When calling/executing graphs from within graph, the whole dictionary can be passed into the called graph.
  • Avatar
    dpavlis
    0
    Comment actions Permalink
    getGraph().getGraphProperties().setProperty("newProperty", value );


    This construct is available only in Java (not CTL). So you would have to create Java class implementing RecordTransform.
    See this piece of doc.

    However that would not help you much as graph parameters/properties are resolved during graph init and are not updated during runtime. Think of it as a kind of
    macro which modifies the "source code" just before it gets compiled into transformation graph representation. The only dynamic structure is dictionary (or lookup table).

Please sign in to leave a comment.