<?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: How to parse a string name field (lastname, firstname middlename? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213329#M10622</link>
    <description>&lt;P&gt;I added your code. But when it runs it error's.&lt;/P&gt;
&lt;P&gt;See attached document for screen pages (showing the tMap and run error messages)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the details of my code:&lt;/P&gt;
&lt;P&gt;1. My input field name is: row1.LicenseeName&lt;/P&gt;
&lt;P&gt;2. The Var Expression is: row1.LicenseeName.substring(row1.LicenseeName.indexOf(",")+1).trim()&lt;/P&gt;
&lt;P&gt;3. Variable name is:&amp;nbsp; last_part&lt;/P&gt;
&lt;P&gt;4. The output field names contain the following:&lt;/P&gt;
&lt;P&gt;LicenseeName =row1.LicenseeName&amp;nbsp;&lt;/P&gt;
&lt;P&gt;fname = row1.LicenseeName.substring(0,row1.LicenseeName.indexOf(","))&amp;nbsp;&lt;/P&gt;
&lt;P&gt;lname = Var.last_part.substring(0,Var.last_part.indexOf(" "))&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mname = Var.last_part.substring(Var.last_part.indexOf(" ")+1)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It errors on the first row where the row1.LicenseeName = KNOWLES, JONATHAN&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please advise of what to do next?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LxES"&gt;TalendError12132019.docx&lt;/A&gt;</description>
    <pubDate>Fri, 13 Dec 2019 18:58:45 GMT</pubDate>
    <dc:creator>profuse</dc:creator>
    <dc:date>2019-12-13T18:58:45Z</dc:date>
    <item>
      <title>How to parse a string name field (lastname, firstname middlename?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213327#M10620</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;From a CSV file, could someone tell me how to parse a string field that contains the persons lastname, firstname middlename? Where the lastname always ends in a comma, then first name and then the middle name is last.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Here is an example:&lt;/P&gt; 
&lt;P&gt;SMITH, JOHN LEO&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Then I would like to move:&lt;/P&gt; 
&lt;P&gt;The lastname SMITH to a new column called lastname&lt;/P&gt; 
&lt;P&gt;The firstname JOHN to a new column called firstname&lt;/P&gt; 
&lt;P&gt;The middlename LEO to a new column called middlename&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;How do you parse it into 3 new columns?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thank you in advance!&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:50:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213327#M10620</guid>
      <dc:creator>profuse</dc:creator>
      <dc:date>2024-11-16T03:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a string name field (lastname, firstname middlename?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213328#M10621</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp;I believe you are looking for below solution.&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="image.png" style="width: 787px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8mP.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154240i94601F66C30E7A34/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8mP.png" alt="0683p000009M8mP.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The tMap is as shown below.&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="image.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8mU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/139485i2032C1D3511D39B1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8mU.png" alt="0683p000009M8mU.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Please refer the functions used below.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;last_part =       row1.data.substring(row1.data.indexOf(",")+1).trim() 
fname     =       row1.data.substring(0,row1.data.indexOf(",")) 
lname     =       Var.last_part.substring(0,Var.last_part.indexOf(" "))
mname   =       Var.last_part.substring(Var.last_part.indexOf(" ")+1)&lt;/PRE&gt; 
&lt;P&gt;Please note that I have created the solution for happy path. If some of the data is not there, it will result in NULL and you will have to add the additional logic for NULL handling. Well, I would let you handle it as there are lot of community posts already related to that topic.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Please spare a second to mark the topic as resolved. Kudos will be a bonus from your end &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt; 
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 02:30:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213328#M10621</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-13T02:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a string name field (lastname, firstname middlename?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213329#M10622</link>
      <description>&lt;P&gt;I added your code. But when it runs it error's.&lt;/P&gt;
&lt;P&gt;See attached document for screen pages (showing the tMap and run error messages)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the details of my code:&lt;/P&gt;
&lt;P&gt;1. My input field name is: row1.LicenseeName&lt;/P&gt;
&lt;P&gt;2. The Var Expression is: row1.LicenseeName.substring(row1.LicenseeName.indexOf(",")+1).trim()&lt;/P&gt;
&lt;P&gt;3. Variable name is:&amp;nbsp; last_part&lt;/P&gt;
&lt;P&gt;4. The output field names contain the following:&lt;/P&gt;
&lt;P&gt;LicenseeName =row1.LicenseeName&amp;nbsp;&lt;/P&gt;
&lt;P&gt;fname = row1.LicenseeName.substring(0,row1.LicenseeName.indexOf(","))&amp;nbsp;&lt;/P&gt;
&lt;P&gt;lname = Var.last_part.substring(0,Var.last_part.indexOf(" "))&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mname = Var.last_part.substring(Var.last_part.indexOf(" ")+1)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It errors on the first row where the row1.LicenseeName = KNOWLES, JONATHAN&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please advise of what to do next?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LxES"&gt;TalendError12132019.docx&lt;/A&gt;</description>
      <pubDate>Fri, 13 Dec 2019 18:58:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213329#M10622</guid>
      <dc:creator>profuse</dc:creator>
      <dc:date>2019-12-13T18:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a string name field (lastname, firstname middlename?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213330#M10623</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; Like I mentioned in my previous post, I know this error will come and my intention was to let you try to reach the solution yourself. I believe you are stuck now and here is the solution. You need to make minor changes in the code by adding java contains function in your existing code. The output will look like below.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="image.png" style="width: 783px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8LJ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/140195i94213E15B9E1456B/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8LJ.png" alt="0683p000009M8LJ.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;You need to use below java code in tMap.&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="image.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8LO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154681i4D307A1044C71439/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8LO.png" alt="0683p000009M8LO.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;lname =

Var.last_part.contains(" ")? Var.last_part.substring(0,Var.last_part.indexOf(" ")) : Var.last_part 

mname =

Var.last_part.contains(" ")? Var.last_part.substring(Var.last_part.indexOf(" ")+1):"" &lt;/PRE&gt; 
&lt;P&gt;I would really appreciate if you could spare a second to mark the topic as resolved as it will help other Community members during their reference and its a way of thanking the author for volunteering their time. Kudos will be a bonus from your end &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt; 
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2019 03:25:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213330#M10623</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-14T03:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse a string name field (lastname, firstname middlename?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213331#M10624</link>
      <description>&lt;P&gt;Nikhil Thampi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wow that's great coding, the perfect solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your absolutely the best.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 18:37:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-parse-a-string-name-field-lastname-firstname-middlename/m-p/2213331#M10624</guid>
      <dc:creator>profuse</dc:creator>
      <dc:date>2019-12-16T18:37:06Z</dc:date>
    </item>
  </channel>
</rss>

