<?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 Re: Google Drive Folder Path Extraction in Talend in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Google-Drive-Folder-Path-Extraction-in-Talend/m-p/2509498#M141845</link>
    <description>&lt;P&gt;EDIT : Corrected my solution, now it looks better.&lt;/P&gt;&lt;P&gt;So I created a csv file with your example data and managed to make it working, I made a mistake before and forgot you can't create functions inside tJavaRow.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the full setup :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="quentinvigne_0-1741785589954.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/178447i7A3D8CF17D057370/image-size/medium?v=v2&amp;amp;px=400" role="button" title="quentinvigne_0-1741785589954.png" alt="quentinvigne_0-1741785589954.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Your input data feed a first &lt;STRONG&gt;tJavaRow&lt;/STRONG&gt; that fill a Map to get your data in memory&lt;/P&gt;&lt;P&gt;Inside your &lt;STRONG&gt;tJavaRow&lt;/STRONG&gt; add this code :&lt;/P&gt;&lt;LI-CODE lang="java"&gt;java.util.Map&amp;lt;String, String[]&amp;gt; fileMap = (java.util.Map&amp;lt;String, String[]&amp;gt;) globalMap.get("fileMap");

if (fileMap == null) {
    fileMap = new java.util.HashMap&amp;lt;&amp;gt;();
    globalMap.put("fileMap", fileMap);
}

fileMap.put(input_row.id, new String[]{input_row.name, input_row.parents});

output_row.id = input_row.id;
output_row.name = input_row.name;
output_row.parents = input_row.parents;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Feed the output data to a &lt;STRONG&gt;tHashOutput&amp;nbsp;&lt;/STRONG&gt;(needed to keep the data in memory while also keeping the HashMap)&lt;/P&gt;&lt;P&gt;Then in a new subjob start with a &lt;STRONG&gt;tHashInput&lt;/STRONG&gt; that will go to your second &lt;STRONG&gt;tJavaRow&amp;nbsp;&lt;/STRONG&gt;containing the most important part :&lt;/P&gt;&lt;LI-CODE lang="java"&gt;java.util.Map&amp;lt;String, String[]&amp;gt; fileMap = (java.util.Map&amp;lt;String, String[]&amp;gt;) globalMap.get("fileMap");

StringBuilder fullPath = new StringBuilder();
String parentId = input_row.parents;

while (parentId != null &amp;amp;&amp;amp; !parentId.isEmpty() &amp;amp;&amp;amp; fileMap.containsKey(parentId)) {
    String[] data = fileMap.get(parentId);
    fullPath.insert(0, "/" + data[0]);
    parentId = data[1];
}

fullPath.append("/").append(input_row.name);

output_row.id = input_row.id;
output_row.name = input_row.name;
output_row.parents = input_row.parents;
output_row.fullPath = fullPath.toString();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="quentinvigne_1-1741785745131.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/178448i8C6DA94D7E960B20/image-size/medium?v=v2&amp;amp;px=400" role="button" title="quentinvigne_1-1741785745131.png" alt="quentinvigne_1-1741785745131.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Quentin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Mar 2025 13:25:29 GMT</pubDate>
    <dc:creator>quentin-vigne</dc:creator>
    <dc:date>2025-03-12T13:25:29Z</dc:date>
    <item>
      <title>Google Drive Folder Path Extraction in Talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Google-Drive-Folder-Path-Extraction-in-Talend/m-p/2509404#M141836</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm trying to resolve full folder paths for files in Google Drive using Talend. Given a dataset with file ID, name, parent ID, I need to reconstruct the hierarchical path by tracing parent-child relationships.&lt;/P&gt;&lt;P&gt;Logic I Tried (Using tJavaFlex):&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Load data (id, name, parent) into a HashMap for lookup.&lt;/LI&gt;&lt;LI&gt;Iterate over each row, recursively tracing the parent ID until no parent is found.&lt;/LI&gt;&lt;LI&gt;Concatenate folder names to build the path.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":police_car_light:"&gt;🚨&lt;/span&gt; Issue: JavaFlex isn't working properly—it either causes performance issues or doesn’t return full paths correctly.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Sample Input (Extracted Google Drive Metadata - Excel/CSV format)" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/178414i427A55831F75A84E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sampleinput.png" alt="Sample Input (Extracted Google Drive Metadata - Excel/CSV format)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Sample Input (Extracted Google Drive Metadata - Excel/CSV format)&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Expected Output (After Full Path Resolution)" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/178415i1F260C90C3B83388/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sampleoutput.png" alt="Expected Output (After Full Path Resolution)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Expected Output (After Full Path Resolution)&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Question:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":pushpin:"&gt;📌&lt;/span&gt; Is there a better way to handle recursive folder paths in Talend? Could tMap, tLoop, or a different approach work better? Any suggestions would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 06:14:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Google-Drive-Folder-Path-Extraction-in-Talend/m-p/2509404#M141836</guid>
      <dc:creator>abarpdata_18</dc:creator>
      <dc:date>2025-03-12T06:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Google Drive Folder Path Extraction in Talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Google-Drive-Folder-Path-Extraction-in-Talend/m-p/2509435#M141839</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/331359"&gt;@abarpdata_18&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe try to use tJavaRow with a while function to get your full path from iterations (tJavaRow would be more suited in my opinion to do this, since tJavaFlex doesn't hand recursion very well and tend to cause stack overflows when doing too much looping)&lt;/P&gt;&lt;P&gt;Create as you did before a HashMap with &lt;STRONG&gt;id, name and parent&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;String buildPath(String id, HashMap&amp;lt;String, String[]&amp;gt; map) {
    StringBuilder fullPath = new StringBuilder();
    
    while (id != null &amp;amp;&amp;amp; !id.isEmpty() &amp;amp;&amp;amp; map.containsKey(id)) {
        String[] data = map.get(id);
        fullPath.insert(0, "/" + data[0]);
        id = data[1]; 
    }
    
    return fullPath.toString();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tell me if it work (or doesn't)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Quentin&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 09:04:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Google-Drive-Folder-Path-Extraction-in-Talend/m-p/2509435#M141839</guid>
      <dc:creator>quentin-vigne</dc:creator>
      <dc:date>2025-03-12T09:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Google Drive Folder Path Extraction in Talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Google-Drive-Folder-Path-Extraction-in-Talend/m-p/2509454#M141843</link>
      <description>&lt;P&gt;Thanks for your suggestion! I tried implementing tJavaRow with the buildPath function, but I’m running into some errors:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Compilation errors&lt;/STRONG&gt; related to HashMap and Map not being recognized.&lt;/LI&gt;&lt;LI&gt;Talend is throwing a &lt;STRONG&gt;syntax error on the function declaration&lt;/STRONG&gt;, saying "Syntax error on token '(' , ';' expected".&lt;/LI&gt;&lt;LI&gt;"Void methods cannot return a value" error is appearing.&lt;/LI&gt;&lt;LI&gt;"FullPath cannot be resolved or is not a field" error is showing up.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I ensured that import java.util.HashMap; and import java.util.Map; are present, and that FullPath exists in the schema.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Prabavathy_18_0-1741775225954.png" style="width: 315px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/178427iB7A2CF08D2D3C68B/image-dimensions/315x236?v=v2" width="315" height="236" role="button" title="Prabavathy_18_0-1741775225954.png" alt="Prabavathy_18_0-1741775225954.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Prabavathy_18_1-1741775259232.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/178428i2A8DF2995F148BA2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Prabavathy_18_1-1741775259232.png" alt="Prabavathy_18_1-1741775259232.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Would you have any additional suggestions or tweaks I should try? Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 10:29:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Google-Drive-Folder-Path-Extraction-in-Talend/m-p/2509454#M141843</guid>
      <dc:creator>abarpdata_18</dc:creator>
      <dc:date>2025-03-12T10:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Google Drive Folder Path Extraction in Talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Google-Drive-Folder-Path-Extraction-in-Talend/m-p/2509498#M141845</link>
      <description>&lt;P&gt;EDIT : Corrected my solution, now it looks better.&lt;/P&gt;&lt;P&gt;So I created a csv file with your example data and managed to make it working, I made a mistake before and forgot you can't create functions inside tJavaRow.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the full setup :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="quentinvigne_0-1741785589954.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/178447i7A3D8CF17D057370/image-size/medium?v=v2&amp;amp;px=400" role="button" title="quentinvigne_0-1741785589954.png" alt="quentinvigne_0-1741785589954.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Your input data feed a first &lt;STRONG&gt;tJavaRow&lt;/STRONG&gt; that fill a Map to get your data in memory&lt;/P&gt;&lt;P&gt;Inside your &lt;STRONG&gt;tJavaRow&lt;/STRONG&gt; add this code :&lt;/P&gt;&lt;LI-CODE lang="java"&gt;java.util.Map&amp;lt;String, String[]&amp;gt; fileMap = (java.util.Map&amp;lt;String, String[]&amp;gt;) globalMap.get("fileMap");

if (fileMap == null) {
    fileMap = new java.util.HashMap&amp;lt;&amp;gt;();
    globalMap.put("fileMap", fileMap);
}

fileMap.put(input_row.id, new String[]{input_row.name, input_row.parents});

output_row.id = input_row.id;
output_row.name = input_row.name;
output_row.parents = input_row.parents;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Feed the output data to a &lt;STRONG&gt;tHashOutput&amp;nbsp;&lt;/STRONG&gt;(needed to keep the data in memory while also keeping the HashMap)&lt;/P&gt;&lt;P&gt;Then in a new subjob start with a &lt;STRONG&gt;tHashInput&lt;/STRONG&gt; that will go to your second &lt;STRONG&gt;tJavaRow&amp;nbsp;&lt;/STRONG&gt;containing the most important part :&lt;/P&gt;&lt;LI-CODE lang="java"&gt;java.util.Map&amp;lt;String, String[]&amp;gt; fileMap = (java.util.Map&amp;lt;String, String[]&amp;gt;) globalMap.get("fileMap");

StringBuilder fullPath = new StringBuilder();
String parentId = input_row.parents;

while (parentId != null &amp;amp;&amp;amp; !parentId.isEmpty() &amp;amp;&amp;amp; fileMap.containsKey(parentId)) {
    String[] data = fileMap.get(parentId);
    fullPath.insert(0, "/" + data[0]);
    parentId = data[1];
}

fullPath.append("/").append(input_row.name);

output_row.id = input_row.id;
output_row.name = input_row.name;
output_row.parents = input_row.parents;
output_row.fullPath = fullPath.toString();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="quentinvigne_1-1741785745131.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/178448i8C6DA94D7E960B20/image-size/medium?v=v2&amp;amp;px=400" role="button" title="quentinvigne_1-1741785745131.png" alt="quentinvigne_1-1741785745131.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Quentin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 13:25:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Google-Drive-Folder-Path-Extraction-in-Talend/m-p/2509498#M141845</guid>
      <dc:creator>quentin-vigne</dc:creator>
      <dc:date>2025-03-12T13:25:29Z</dc:date>
    </item>
  </channel>
</rss>

