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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Prasanna3
Contributor
Contributor

Scenario based Question in Talend???

Hi
Can any one provide me solution for this?

Input:
stringid stringidentifier Fiscalyear Quarter1 salesvolume1 quarter2 salesvolume2 quarter salesvolume3 quarter4 salesvolume4
14360 Newyork FY-2014 Q1 500 Q2 600 Q3 500 Q4 1100
15620 London FY-2015 Q1 450 Q2 700 Q3 300 Q4 400

Output:
stringid stringidentifier Fiscalyear Quarter salesvolume
14360 Newyork FY-2014 Q1 values
14360 Newyork FY-2014 Q2 values
14360 Newyork FY-2014 Q3 values
14360 Newyork FY-2014 Q4 values
Labels (2)
5 Replies
fdenis
Master
Master

tMap to group your data by Qx value then tNormalize
or
tMap full joined to table of 4 row (Q1 Q2 Q3 Q4) to split row in line

Good luck!
iamabhishek
Creator III
Creator III

There is no straight forward way to achieve normalization on multiple columns. So, to achieve what you want the solution needs to be tweaked.

Job Layout - 

0683p000009LzUG.jpg

The tMap is basically concatenating the different Quartern salesvolumen columns into one - Quarter  & SalesVolume respectively. 

row52.Quarter1 + ";" + row52.Quarter2 + ";" + row52.quarter3 + ";" + row52.quarter4

&

row52.salesvolume1 + ";" + row52.salesvolume2  + ";" +row52.salesvolume3 + ";" + row52.salesvolume4 

Once done pass them through tFlowToIterate so that your two rows are iterated separately and normalized accordingly. Once they are pushed to tJavaFlex the code would read them as once converted to array[] would iterate on each element and pass one row by row to output.

// start part of your Java code
String QuarterNames = (String)globalMap.get("out14.Quarter");
String SalesVolumes = (String)globalMap.get("out14.SalesVolume");
String[] quarterArray = QuarterNames.split(";");
String[] salesVolumeArray = SalesVolumes.split(";");
for( int i = 0; i < quarterArray.length; i++) {      

// here is the main part of the component,
// a piece of code executed in the row
// loop
row56.stringid = out14.stringid;
row56.stringidentifier = out14.stringidentifier;
row56.Fiscalyear = out14.Fiscalyear;
row56.Quarter = quarterArray[i];
row56.SalesVolume = salesVolumeArray[i];
//System.out.println(quarterArray[i]);

// end of the component, outside/closing the loop
}

You could directly connect the tJavaFlex to your desired output component or if you want all of them to stored/displayed in a one shot then you could store them temporarily to tHashOutput and then read through tHashInput and display/write to the component (in my case tLogRow).

Morpheus
Contributor III
Contributor III

Simple solution

tFileInputDelimiter-->tMap-->tNormalize-->tMap-->tLogRow

 

  1. In the first tMap you combine the fields with values to a one with a different field separator for the group_content_field.
    e.g.group_content_field= row1.q1 + " " + row1.sv1 + "~" + row1.q2 + " " + row1.sv2  + "~" + row1.q3 + " " + row1.sv3 + "~" + row1.q4 + " " + row1.sv4
  2. In the tNormalize, split by the "~"
  3. In the next tMap split it by space and use the array index to populate the columns as needed.

 

TRF
Champion II
Champion II

You have already ask this question and got the answer here https://community.talend.com/t5/Design-and-Development/Project-scenarios/m-p/131822#M82237
Prasanna3
Contributor
Contributor
Author

Hi
I got the answer.but I will work on it and get back to you.