<?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 Logic inside tRowJava in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Logic-inside-tRowJava/m-p/2282359#M56598</link>
    <description>&lt;P&gt;Hi, I'm fairly new to Talend (we're a licensed customer, Talend Big Data) so thanks in advance.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;So in tRowJava, I want get the domain name from a string called url. So I have a &lt;STRONG&gt;input_row.url&lt;/STRONG&gt; and an &lt;STRONG&gt;output_row.url&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I found the below function but I can't seem to refer to it when I put in inside the body of the code. I've also tried pulling pieces out of the function (URI uri = new URI(url)&lt;IMG id="smileywink" class="emoticon emoticon-smileywink" src="https://yutwg22796.i.lithium.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt; and put in body of code but that doesn't seem to work either. Any suggestion on how I can achieve this? Thank you!&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;public String getHostName(String url) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;URI uri = new URI(url);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;String hostname = uri.getHost();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;// to provide faultproof result, check if not null then return only hostname, without www.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;if (hostname != null) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;return hostname.startsWith("www.") ? hostname.substring(4) : hostname;&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;return hostname;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;}&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:22:49 GMT</pubDate>
    <dc:creator>jimbo20814</dc:creator>
    <dc:date>2024-11-16T03:22:49Z</dc:date>
    <item>
      <title>Logic inside tRowJava</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Logic-inside-tRowJava/m-p/2282359#M56598</link>
      <description>&lt;P&gt;Hi, I'm fairly new to Talend (we're a licensed customer, Talend Big Data) so thanks in advance.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;So in tRowJava, I want get the domain name from a string called url. So I have a &lt;STRONG&gt;input_row.url&lt;/STRONG&gt; and an &lt;STRONG&gt;output_row.url&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I found the below function but I can't seem to refer to it when I put in inside the body of the code. I've also tried pulling pieces out of the function (URI uri = new URI(url)&lt;IMG id="smileywink" class="emoticon emoticon-smileywink" src="https://yutwg22796.i.lithium.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt; and put in body of code but that doesn't seem to work either. Any suggestion on how I can achieve this? Thank you!&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;public String getHostName(String url) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;URI uri = new URI(url);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;String hostname = uri.getHost();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;// to provide faultproof result, check if not null then return only hostname, without www.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;if (hostname != null) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;return hostname.startsWith("www.") ? hostname.substring(4) : hostname;&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;return hostname;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;}&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:22:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Logic-inside-tRowJava/m-p/2282359#M56598</guid>
      <dc:creator>jimbo20814</dc:creator>
      <dc:date>2024-11-16T03:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Logic inside tRowJava</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Logic-inside-tRowJava/m-p/2282360#M56599</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'll need to either refactor that code as a static class and call it as a static routine, or bring into into the tJavaRow, but as Java statements rather than a public class - something &lt;STRONG&gt;like&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;URI uri = new URI(input_row.url);

String hostname = uri.getHost();

if (hostname != null) {
output_row.hostname = hostname.startsWith("www.") ? hostname.substring(4) : hostname;

}
output_row.hostname = hostname;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 07:50:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Logic-inside-tRowJava/m-p/2282360#M56599</guid>
      <dc:creator>David_Beaty</dc:creator>
      <dc:date>2020-02-04T07:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Logic inside tRowJava</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Logic-inside-tRowJava/m-p/2282361#M56600</link>
      <description>&lt;P&gt;Thank you, I removed the code from class in just put inline inside main body. To keep simple, I hardcoded URL and just started with the first line (&lt;/P&gt; 
&lt;PRE&gt;URI uri = new URI("https://jimbo.com");&lt;/PRE&gt; 
&lt;P&gt;) and it returns "URI cannot be resolved to a type"&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 15:41:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Logic-inside-tRowJava/m-p/2282361#M56600</guid>
      <dc:creator>jimbo20814</dc:creator>
      <dc:date>2020-02-04T15:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Logic inside tRowJava</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Logic-inside-tRowJava/m-p/2282362#M56601</link>
      <description>&lt;P&gt;You need to import the java.net package to do this or use the following code...&lt;/P&gt; 
&lt;PRE&gt;java.net.URI uri = new java.net.URI("https://jimbo.com");&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Feb 2020 16:43:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Logic-inside-tRowJava/m-p/2282362#M56601</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-07T16:43:10Z</dc:date>
    </item>
  </channel>
</rss>

