One Star

How to programatically set range parameter value for tSampleRow

I am trying to use tSampleRow and I desire to programmatically set the Range that is used rather than hardcoding the Range component parameter. In the component setting, if you hover over the setting for the Range parameter, it displays, "The variable attached to this parameter is:__RANGE__". I was hoping this meant that you could somehow set this parameter prior to executing this component instance in the job.
In my case, I have an input file that has a variable that essentially points to a record number in another file (like an index to a record number). I tried to use tJavaRow to set a context variable (context.__RANGE__to that index...appended for each input row with a comma separating each value). This didn't work. So, I tried to define (in Contexts tab) a variable named __RANGE__, but that is not a valid variable name.
Can you help me understand 1) can the variable be programmatically set to desired values?, and 2) what needs to be set to achieve this? I am essentially trying to read records x, y, z of FileA where x, y, z are specified as variables in FileB.

Re: How to programatically set range parameter value for tSampleRow

You're close Smiley Wink
The hover note is mainly for component development-- the __RANGE__ variable exists in the JET code inside the component-- it is not exposed to your job code.

To use a varible in the tSampleRow-- create your context variable (i.e. context.range ), then in the components "Range" text box put:
Community Manager

Re: How to programatically set range parameter value for tSampleRow

Define a context variable, string type, null value by default. The job looks like:
on tJavaRow:
on tSampleRow:
Best regards
Talend | Data Agility for Modern Business