Using tRowGenerator with getRandomString() -- random values from list

One Star

Using tRowGenerator with getRandomString() -- random values from list

Hi All,
I have not been able to find talk of this particular feature other than in this thread:
h t t p : // talend forge . org /forum/viewtopic.php?id=21
So if this subject has already been mentionned elsewhere, please redirect me accordingly.
Basically, using the row generator component, I am trying to produce random picks from a list (say... East, West, North, South) over several rows.
According to the above mentionned thread, as i understand it, one would create a column of type string, not specify a function (...) , skip down to the function parameters tab, and insert in the Value field : "sub{getRandomString(1, )}" without the double quote marks. This unfortunately yields the error message
"Exception in thread "main" java.lang.Error: Unresolved compilation problem: " 
Hence my question to you, has use of the function been deprecated and is something else to be used instead, or am i just doing something wrong?
Tags (1)
Community Manager

Re: Using tRowGenerator with getRandomString() -- random values from list

Hi 
Select "..." from the function list, and define the Value field as: "East", "West", "North", "South"
It will generate a random value from the list for each row.

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Using tRowGenerator with getRandomString() -- random values from list

It works, thanks. 

But to be clear, is sub{getRandomString()} deprecated?

Community Manager

Re: Using tRowGenerator with getRandomString() -- random values from list

I don't see this function and I have never used it. Please let me know If you know where this function is defined, I can check it out. 
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Using tRowGenerator with getRandomString() -- random values from list

I don't see this function and I have never used it. Please let me know If you know where this function is defined, I can check it out. 

check the above mentionned URL (can't post the live one) viewtopic.php?id=21:
Basically, tRowGenerator is used as an input stream. It can generate as many rows as you want and as many fields as you want. You can control the number of rows with the "Number of rows" property which must be an integer value. You control the number of fields per row with the number of lines in the "Values" table property. This "Values" table is what needs a deeper introduction.
In each line of the "Values" table, TOS is waiting for a Perl expression corresponding to a list. At each row creation, for each field, the Perl generated script will choose randomly between the values in the given list.
...
- "sub{getRandomString(5, )}" will return a random string made of 5 consonants. This function looks like the two others but here you can choose the characters.
Also, please note the use of single quote marks (')  by nrousseau to frame the various string (resulting in compilation problems), instead of your double quote marks (") which works.
Community Manager

Re: Using tRowGenerator with getRandomString() -- random values from list

Hi  
The topic you mentioned was rather older, it is a perl function that is used in the earlier version, but now Perl language is not support any more. 
----------------------------------------------------------
Talend | Data Agility for Modern Business