Change value for parameters using reformat component

Hi Team,

I am trying to find out a method on how to change the value of a parameter that I have defined and also how to create a new parameter dynamically using REFORMAT component in Clover ETL.

I have written small logic in my transform method which reformat component provides:

function integer transform() {
	string parameter1 = getParamValue("PARAM_1");
        // modifyParameterValue("PARAM_1", "my_new_value");
        //createNewParameter("PARAM_2","this_is_new_param");
	return OK;
}

  1. When I tried to find the list of available methods I was not able to get a method that helps me to update the value of my parameter PARAM_1. Please let me know if there is any method that helps me to achieve this?

  2. Also if we change a parameter here, then can we control the visibility of the changed value in other subsequent child graphs?

  3. If I have a parent graphs with multiple phases say phase-0 and phase-1, now if some child graph which is invoked by phase-0 has done the change, then can the components in phase-1 of parent graph still use old value?

  4. Do we have any methods that allows us to create new parameters dynamically?

I am new to Clover ETL so I am facing difficulty in this, please help me.

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+.

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 );

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.

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.

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).