<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Very Challenging Scenario, Reading Excel and Lookup in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Very-Challenging-Scenario-Reading-Excel-and-Lookup/m-p/2300131#M72390</link>
    <description>Hi Guys, 
&lt;BR /&gt;I have a scenario and hope you can help me with this: 
&lt;BR /&gt;Input: 
&lt;BR /&gt;&amp;nbsp;REGULATORY_AGENCIES &amp;nbsp; | &amp;nbsp; LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;---- this is a Field Header 
&lt;BR /&gt;&amp;nbsp;10001; 10002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; 10003; 10001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- value 
&lt;BR /&gt;Lookup (in excel) 
&lt;BR /&gt;Field_Header &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; CODE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp;CODE_DESCRIPTION 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10001 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Apple 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10002 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Banana 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10003 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Carrot&amp;nbsp; 
&lt;BR /&gt;LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10001 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Apple Juice 
&lt;BR /&gt;LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10002 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Banana Juice 
&lt;BR /&gt;LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10003 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Carrot Juice 
&lt;BR /&gt;Expected Output: 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; | &amp;nbsp; LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- this is a Field Header 
&lt;BR /&gt;&amp;nbsp;Apple; Banana &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; Carrot Juice; Apple Juice &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- value 
&lt;BR /&gt;In this example, I need my Input to lookup to the lookup table and return its description. I have already created a Routines functions with this that reads a excel file (my lookup table) and return its value. BUT I have only relate CODE and CODE_DESCRIPTION. thats why I'm getting multiple values: 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- this is a Field Header 
&lt;BR /&gt;&amp;nbsp;Apple; Apple Juice; Banana; Banana Juice&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; Carrot; Carrot Juice; Apple; Apple Juice &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- value 
&lt;BR /&gt;My question is, how can I use or read my HEADER in Input so that I can relate it to the FIELD_HEADER in the lookup table? Here is my code: 
&lt;BR /&gt; 
&lt;PRE&gt;public static String splitColumnHandling(String Field)&lt;BR /&gt;{&lt;BR /&gt;String str = Field;&lt;BR /&gt;		String ValueHolder="";&lt;BR /&gt;		String[] myarray = str.split("; ");&lt;BR /&gt;		String a="";&lt;BR /&gt;		String b="";&lt;BR /&gt;		&lt;BR /&gt;		try&lt;BR /&gt;		{&lt;BR /&gt;		//Create Workbook instance holding reference to .xlsx file&lt;BR /&gt;		FileInputStream file = new FileInputStream(new File("D:\\MY PROJECT\\lookup_table.xlsx"));&lt;BR /&gt;		XSSFWorkbook workbook = new XSSFWorkbook(file);&lt;BR /&gt;		 &lt;BR /&gt;			//Get first/desired sheet from the workbook&lt;BR /&gt;				XSSFSheet sheet = workbook.getSheetAt(0);&lt;BR /&gt;				//begin loop spliting &lt;BR /&gt;				for(int i = 0; i &amp;lt; myarray.length; i++)&lt;BR /&gt;				{&lt;BR /&gt;					a=myarray&lt;I&gt;.toString();	 &lt;BR /&gt;					 //Iterate through each rows one by one&lt;BR /&gt;					Iterator&amp;lt;Row&amp;gt; rowIterator = sheet.iterator();&lt;BR /&gt;					for(int x = 0; x &amp;lt; sheet.getPhysicalNumberOfRows(); x++)&lt;BR /&gt;					{&lt;BR /&gt;						//Declare cell position to be read&lt;BR /&gt;						Row row = rowIterator.next();&lt;BR /&gt;						CellReference pos_return_value = new CellReference("D1");&lt;BR /&gt;						CellReference pos_lookup_codes = new CellReference("C1");&lt;BR /&gt;						Cell get_return_value = row.getCell(pos_return_value.getCol());&lt;BR /&gt;						Cell get_lookup_codes = row.getCell(pos_lookup_codes.getCol());&lt;BR /&gt;						&lt;BR /&gt;							if(a.equals(get_lookup_codes.getStringCellValue()))&lt;BR /&gt;							{	&lt;BR /&gt;								if(i!=(myarray.length-1)){&lt;BR /&gt;									ValueHolder=ValueHolder+get_return_value+"; ";&lt;BR /&gt;								}else{&lt;BR /&gt;									ValueHolder=ValueHolder+get_return_value+"";&lt;BR /&gt;								}	&lt;BR /&gt;							}&lt;BR /&gt;							else if(a.equals("NONE SPECIFIED") )&lt;BR /&gt;							{&lt;BR /&gt;								ValueHolder="NONE SPECIFIED";&lt;BR /&gt;							}&lt;BR /&gt;					}&lt;BR /&gt;					b=b+"\n"+a; &lt;BR /&gt;				} &lt;BR /&gt;			&lt;BR /&gt;		if (ValueHolder.isEmpty()){&lt;BR /&gt;				ValueHolder=Field;&lt;BR /&gt;			}&lt;BR /&gt;		}catch(Exception e )&lt;BR /&gt;		{}&lt;BR /&gt;		return String.valueOf(ValueHolder);&lt;BR /&gt;	}	&lt;BR /&gt;}//end&lt;/I&gt;&lt;/PRE&gt; 
&lt;BR /&gt;Thank you so much and hope you can help me with it 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACJ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133049iD780B7DE0116E4D1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACJ.png" alt="0683p000009MACJ.png" /&gt;&lt;/span&gt;</description>
    <pubDate>Fri, 26 Aug 2016 02:24:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-08-26T02:24:11Z</dc:date>
    <item>
      <title>Very Challenging Scenario, Reading Excel and Lookup</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Very-Challenging-Scenario-Reading-Excel-and-Lookup/m-p/2300131#M72390</link>
      <description>Hi Guys, 
&lt;BR /&gt;I have a scenario and hope you can help me with this: 
&lt;BR /&gt;Input: 
&lt;BR /&gt;&amp;nbsp;REGULATORY_AGENCIES &amp;nbsp; | &amp;nbsp; LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;---- this is a Field Header 
&lt;BR /&gt;&amp;nbsp;10001; 10002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; 10003; 10001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- value 
&lt;BR /&gt;Lookup (in excel) 
&lt;BR /&gt;Field_Header &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; CODE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp;CODE_DESCRIPTION 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10001 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Apple 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10002 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Banana 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10003 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Carrot&amp;nbsp; 
&lt;BR /&gt;LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10001 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Apple Juice 
&lt;BR /&gt;LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10002 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Banana Juice 
&lt;BR /&gt;LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; 10003 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; Carrot Juice 
&lt;BR /&gt;Expected Output: 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; | &amp;nbsp; LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- this is a Field Header 
&lt;BR /&gt;&amp;nbsp;Apple; Banana &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; Carrot Juice; Apple Juice &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- value 
&lt;BR /&gt;In this example, I need my Input to lookup to the lookup table and return its description. I have already created a Routines functions with this that reads a excel file (my lookup table) and return its value. BUT I have only relate CODE and CODE_DESCRIPTION. thats why I'm getting multiple values: 
&lt;BR /&gt;REGULATORY_AGENCIES &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; LEAD_AGENCY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- this is a Field Header 
&lt;BR /&gt;&amp;nbsp;Apple; Apple Juice; Banana; Banana Juice&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; Carrot; Carrot Juice; Apple; Apple Juice &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---- value 
&lt;BR /&gt;My question is, how can I use or read my HEADER in Input so that I can relate it to the FIELD_HEADER in the lookup table? Here is my code: 
&lt;BR /&gt; 
&lt;PRE&gt;public static String splitColumnHandling(String Field)&lt;BR /&gt;{&lt;BR /&gt;String str = Field;&lt;BR /&gt;		String ValueHolder="";&lt;BR /&gt;		String[] myarray = str.split("; ");&lt;BR /&gt;		String a="";&lt;BR /&gt;		String b="";&lt;BR /&gt;		&lt;BR /&gt;		try&lt;BR /&gt;		{&lt;BR /&gt;		//Create Workbook instance holding reference to .xlsx file&lt;BR /&gt;		FileInputStream file = new FileInputStream(new File("D:\\MY PROJECT\\lookup_table.xlsx"));&lt;BR /&gt;		XSSFWorkbook workbook = new XSSFWorkbook(file);&lt;BR /&gt;		 &lt;BR /&gt;			//Get first/desired sheet from the workbook&lt;BR /&gt;				XSSFSheet sheet = workbook.getSheetAt(0);&lt;BR /&gt;				//begin loop spliting &lt;BR /&gt;				for(int i = 0; i &amp;lt; myarray.length; i++)&lt;BR /&gt;				{&lt;BR /&gt;					a=myarray&lt;I&gt;.toString();	 &lt;BR /&gt;					 //Iterate through each rows one by one&lt;BR /&gt;					Iterator&amp;lt;Row&amp;gt; rowIterator = sheet.iterator();&lt;BR /&gt;					for(int x = 0; x &amp;lt; sheet.getPhysicalNumberOfRows(); x++)&lt;BR /&gt;					{&lt;BR /&gt;						//Declare cell position to be read&lt;BR /&gt;						Row row = rowIterator.next();&lt;BR /&gt;						CellReference pos_return_value = new CellReference("D1");&lt;BR /&gt;						CellReference pos_lookup_codes = new CellReference("C1");&lt;BR /&gt;						Cell get_return_value = row.getCell(pos_return_value.getCol());&lt;BR /&gt;						Cell get_lookup_codes = row.getCell(pos_lookup_codes.getCol());&lt;BR /&gt;						&lt;BR /&gt;							if(a.equals(get_lookup_codes.getStringCellValue()))&lt;BR /&gt;							{	&lt;BR /&gt;								if(i!=(myarray.length-1)){&lt;BR /&gt;									ValueHolder=ValueHolder+get_return_value+"; ";&lt;BR /&gt;								}else{&lt;BR /&gt;									ValueHolder=ValueHolder+get_return_value+"";&lt;BR /&gt;								}	&lt;BR /&gt;							}&lt;BR /&gt;							else if(a.equals("NONE SPECIFIED") )&lt;BR /&gt;							{&lt;BR /&gt;								ValueHolder="NONE SPECIFIED";&lt;BR /&gt;							}&lt;BR /&gt;					}&lt;BR /&gt;					b=b+"\n"+a; &lt;BR /&gt;				} &lt;BR /&gt;			&lt;BR /&gt;		if (ValueHolder.isEmpty()){&lt;BR /&gt;				ValueHolder=Field;&lt;BR /&gt;			}&lt;BR /&gt;		}catch(Exception e )&lt;BR /&gt;		{}&lt;BR /&gt;		return String.valueOf(ValueHolder);&lt;BR /&gt;	}	&lt;BR /&gt;}//end&lt;/I&gt;&lt;/PRE&gt; 
&lt;BR /&gt;Thank you so much and hope you can help me with it 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACJ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133049iD780B7DE0116E4D1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACJ.png" alt="0683p000009MACJ.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Fri, 26 Aug 2016 02:24:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Very-Challenging-Scenario-Reading-Excel-and-Lookup/m-p/2300131#M72390</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-26T02:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Very Challenging Scenario, Reading Excel and Lookup</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Very-Challenging-Scenario-Reading-Excel-and-Lookup/m-p/2300132#M72391</link>
      <description>Hi&amp;nbsp; 
&lt;BR /&gt;Is the Filed Header a fixed value or it might change for each run? If the Field Header are always a constant, you can convert the input data to the below output with tNormalize component.&amp;nbsp; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBIG.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155248i47AF08AD7113CB0A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBIG.png" alt="0683p000009MBIG.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;and then, you are able to do join with the lookup table based on Field_Header and Code columns. 
&lt;BR /&gt;Regards 
&lt;BR /&gt;Shong</description>
      <pubDate>Wed, 07 Sep 2016 04:26:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Very-Challenging-Scenario-Reading-Excel-and-Lookup/m-p/2300132#M72391</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-07T04:26:59Z</dc:date>
    </item>
  </channel>
</rss>

