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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
VictorFaure
Contributor II
Contributor II

tJavaFlex and Data Auto Propagate

Hello, I have some data I need to unpivot and I'm using tJavaFlex to do so, I have the following code:

Start:

for (java.lang.reflect.Field f : row1.getClass().getDeclaredFields()) {

Main:

if (f.getType() == String.class) {
	row2.MATRICULE = row1.MATRICULE;
	row2.fieldName = f.getName();
	row2.fieldValue = f.get(row1).toString();
}

End:

}

 

The problem is some technical byteArray field gets transferred even though I unchecked Data Auto Propagate...

I then have several questions, firstly, how to fix my problem (technical rows that get through) ? And what does Data Auto Propagate even do ? 

Labels (4)
1 Solution

Accepted Solutions
gouravdubey5
Partner - Contributor III
Partner - Contributor III

Hello,

 

This behavior is expected when using tJavaFlex.

Why the technical field is still transferred:
tJavaFlex operates on the entire input row object (row1) at runtime, using Java reflection. The option Data Auto Propagate only controls how Talend auto-maps schemas at design time between components. It does not filter fields at runtime when you explicitly access the row object in custom Java code.

Because you are iterating over:row1.getClass().getDeclaredFields()

all fields in the generated row class are available, including internal or technical fields (e.g. byte arrays), regardless of the Data Auto Propagate setting.

How to fix the issue

You need to explicitly filter the fields you want to process.

Recommended approaches:

Option 1: Filter by field name

if (f.getType() == String.class && !f.getName().startsWith("_")) {
row2.MATRICULE = row1.MATRICULE;
row2.fieldName = f.getName();
row2.fieldValue = String.valueOf(f.get(row1));
}


Option 2: Maintain an allow-list

java.util.Set<String> allowedFields =
new java.util.HashSet<>(java.util.Arrays.asList("COL1", "COL2", "COL3"));

if (f.getType() == String.class && allowedFields.contains(f.getName())) {

}


Option 3 (best practice):
Avoid reflection entirely and explicitly map only the required columns. Reflection-based logic is powerful but error-prone and harder to maintain.

What Data Auto Propagate actually does

Controls automatic schema propagation at design time

Affects row mapping between components

Does not control runtime behavior inside tJava, tJavaRow, or tJavaFlex

Has no effect when fields are accessed programmatically

Best practice:
When using tJavaFlex, always assume full row visibility and explicitly control which fields are processed. Do not rely on Data Auto Propagate for runtime filtering.

 

Thanks,

Gourav

Talend Solution Architect | Data Integration

View solution in original post

2 Replies
gouravdubey5
Partner - Contributor III
Partner - Contributor III

Hello,

 

This behavior is expected when using tJavaFlex.

Why the technical field is still transferred:
tJavaFlex operates on the entire input row object (row1) at runtime, using Java reflection. The option Data Auto Propagate only controls how Talend auto-maps schemas at design time between components. It does not filter fields at runtime when you explicitly access the row object in custom Java code.

Because you are iterating over:row1.getClass().getDeclaredFields()

all fields in the generated row class are available, including internal or technical fields (e.g. byte arrays), regardless of the Data Auto Propagate setting.

How to fix the issue

You need to explicitly filter the fields you want to process.

Recommended approaches:

Option 1: Filter by field name

if (f.getType() == String.class && !f.getName().startsWith("_")) {
row2.MATRICULE = row1.MATRICULE;
row2.fieldName = f.getName();
row2.fieldValue = String.valueOf(f.get(row1));
}


Option 2: Maintain an allow-list

java.util.Set<String> allowedFields =
new java.util.HashSet<>(java.util.Arrays.asList("COL1", "COL2", "COL3"));

if (f.getType() == String.class && allowedFields.contains(f.getName())) {

}


Option 3 (best practice):
Avoid reflection entirely and explicitly map only the required columns. Reflection-based logic is powerful but error-prone and harder to maintain.

What Data Auto Propagate actually does

Controls automatic schema propagation at design time

Affects row mapping between components

Does not control runtime behavior inside tJava, tJavaRow, or tJavaFlex

Has no effect when fields are accessed programmatically

Best practice:
When using tJavaFlex, always assume full row visibility and explicitly control which fields are processed. Do not rely on Data Auto Propagate for runtime filtering.

 

Thanks,

Gourav

Talend Solution Architect | Data Integration
gouravdubey5
Partner - Contributor III
Partner - Contributor III

Hello,

Data Auto Propagate only controls schema propagation at design time. It does not limit runtime access to fields in tJavaFlex, so all fields in the row object are still available unless explicitly filtered in code.

If this resolves the issue, please mark the answer as Accepted Solution.

Thanks,

Gourav

Talend Solution Architect | Data Integration