Change value for parameters using reformat component

Support/help with CloverETL (4.9) and CloverDX (5.0 or newer) implementation problems

chaitanya_r
Posts: 10
Joined: Wed Feb 13, 2013 8:32 am

Change value for parameters using reformat component

Postby chaitanya_r » Thu Dec 26, 2013 1:06 pm

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:

Code: Select all

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.

kubosj
Posts: 372
Joined: Thu Jan 12, 2012 9:10 am

Re: Change value for parameters using reformat component

Postby kubosj » Fri Dec 27, 2013 8:39 am

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+.
Jaroslav Kubos
CloverCARE Support
CloverETL | Rapid Data Integration

Visit us online at http://www.cloveretl.com

chaitanya_r
Posts: 10
Joined: Wed Feb 13, 2013 8:32 am

Re: Change value for parameters using reformat component

Postby chaitanya_r » Fri Dec 27, 2013 3:29 pm

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:

Code: Select all

Properties may be added or replaced like this:
getGraph().getGraphProperties().setProperty("newProperty", value );

dpavlis
Posts: 180
Joined: Sat Mar 10, 2007 8:12 pm

Re: Change value for parameters using reformat component

Postby dpavlis » Sun Dec 29, 2013 6:22 pm

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

Code: Select all

dictionary.<dictionary entry> = <value>;
<variable> = dictionary.<dictionary entry>;


Example:

Code: Select all

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.
David Pavlis
CloverCARE Support
CloverETL | Rapid Data Integration

Visit us online at http://www.cloveretl.com

dpavlis
Posts: 180
Joined: Sat Mar 10, 2007 8:12 pm

Re: Change value for parameters using reformat component

Postby dpavlis » Sun Dec 29, 2013 6:31 pm

Code: Select all

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).
David Pavlis
CloverCARE Support
CloverETL | Rapid Data Integration

Visit us online at http://www.cloveretl.com