Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Bug in tSampleRow Range when using context variables

I am writing data into a DB2 database. Sadly this is slow because the ODBC driver.

For test purposes, I am sampling the data when the context "test" is used, else I take all of them.

 

To show the issue, I created a minimal working example:

0683p000009Lrmy.png

It works flawlessly, when the "Range" field in "tSampleRow_1" component is set to: "1,5,10..20" (the pre-filled example).

What I tried and is not working is the following: "1.." + context.db2_table_HCWH2H1P_sampleSize

In the "test" context, the context variable is set to 100, and in "production" to 99999999.

 

The job is not compiling. The source shows:

String[] rangetSampleRow_1 = "1.." + context.db2_table_HCWH2H1P_sampleSize.split(",");

with the error:

Type mismatch: Cannot convert from String to String[]

My guess is, that "Talend Open Studio for Big Data" is taking the value in the "Range" field, and puts a '.split(",")' at the end.

What happens is, that the context variable gets split rather than the whole string. It ends up with a "String" and this mismatches the "String[]" variable type of "rangetSampleRow_1".

 

An easy solution is, to put some brackets around the "Range" field, and append the '.split(",")' after the closing bracket.

 

For my case, I worked around the problem by putting the whole string "1..100" into the context variable, rather than only the upper bound "100".

 

Additional information:

- Product: Talend Open Studio for Big Data

- Version: 6.4.1

- OS: Win10

- Java: JDK 1.8

 

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Hi,

Use this syntax:

("1.." + context.db2_table_HCWH2H1P_sampleSize)

Hope this helps.

View solution in original post

3 Replies
TRF
Champion II
Champion II

Hi,

Use this syntax:

("1.." + context.db2_table_HCWH2H1P_sampleSize)

Hope this helps.

Anonymous
Not applicable
Author

This works fine. But I still think that it is a bug in Talend.

 

TRF
Champion II
Champion II

Not really. This is due to the way TOS concatenates its part when generationg the Java code.
However don't forget to mark the solution as accepted.