<?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 access column names in a schema in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-access-column-names-in-a-schema/m-p/2347942#M115131</link>
    <description>&lt;P&gt;Hello @Aaron Rumley​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could use the row that connects the component from which you want to extract the column names and convert it fully to String.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lets say you have tDBInput -&amp;gt; row1 -&amp;gt; tJava&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then on tJava component you can use the expression row1.toString() to convert the whole Struct to text. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This expression above will return something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;project.job_0_1.job$row1Struct@3f57bcad[PersonId=value,FirstName=value,LastName=value]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next you could use some regular expression or even some substring/split methods to extract the column names from the resulting String. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jun 2023 16:15:58 GMT</pubDate>
    <dc:creator>anselmopeixoto</dc:creator>
    <dc:date>2023-06-05T16:15:58Z</dc:date>
    <item>
      <title>How to access column names in a schema</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-access-column-names-in-a-schema/m-p/2347941#M115130</link>
      <description>&lt;P&gt;Hello!  Is it possible to somehow figure out what column names are in a schema that's getting passed through?  &lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;Lets say the schema is PersonID, FirstName, LastName.   I would want to generate a string that said "PersonID, FirstName, LastName".  Then I could split this string on the "," and get one-record-per-column-name.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this possible?  One solution I have is to write one record to a CSV, which will have the column names as the first line.  Then read the first line of that CSV as a raw text file.  But this is not an ideal solution at all. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 21:43:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-access-column-names-in-a-schema/m-p/2347941#M115130</guid>
      <dc:creator>aaronrums</dc:creator>
      <dc:date>2024-11-15T21:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to access column names in a schema</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-access-column-names-in-a-schema/m-p/2347942#M115131</link>
      <description>&lt;P&gt;Hello @Aaron Rumley​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could use the row that connects the component from which you want to extract the column names and convert it fully to String.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lets say you have tDBInput -&amp;gt; row1 -&amp;gt; tJava&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then on tJava component you can use the expression row1.toString() to convert the whole Struct to text. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This expression above will return something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;project.job_0_1.job$row1Struct@3f57bcad[PersonId=value,FirstName=value,LastName=value]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next you could use some regular expression or even some substring/split methods to extract the column names from the resulting String. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 16:15:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-access-column-names-in-a-schema/m-p/2347942#M115131</guid>
      <dc:creator>anselmopeixoto</dc:creator>
      <dc:date>2023-06-05T16:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to access column names in a schema</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-access-column-names-in-a-schema/m-p/2347943#M115132</link>
      <description>&lt;P&gt;This is a good start, thank you!  It'd be nice if Talend had some built in functionality for this.  &lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 17:55:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-access-column-names-in-a-schema/m-p/2347943#M115132</guid>
      <dc:creator>aaronrums</dc:creator>
      <dc:date>2023-06-05T17:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to access column names in a schema</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-access-column-names-in-a-schema/m-p/2347944#M115133</link>
      <description>&lt;P&gt;if anyone in the future is interested, here's my code for this.  It probably won't work if one of your columns has a record that has a "," in it's value, or if the value is JSON, since that contains lots of commas and also square brackets. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/***&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;* if your component is connected with a "row1" connection, for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;* then call row1.toString(), and pass in that string to this method.&amp;nbsp;It will produce an array of the column names in row1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;*&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;* At the moment, this doesn't work if the schema contains columns that contain json.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;*&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;public static ArrayList&amp;lt;String&amp;gt; PrintColumnNames(String schemaString)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;	String parsedString = StringHandling.RIGHT(schemaString, schemaString.length() - schemaString.indexOf("[")).replaceAll("\\[|\\]", "");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;	String[] arrayOfStr = parsedString.split(",");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;	ArrayList&amp;lt;String&amp;gt; nameList = new ArrayList&amp;lt;String&amp;gt;();&amp;nbsp;&lt;/P&gt;&lt;P&gt;	&amp;nbsp;&amp;nbsp;for (int i = 0; i &amp;lt; arrayOfStr.length; i++)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;	{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;		String extract = StringHandling.LEFT(arrayOfStr[i], (arrayOfStr[i].length() - (arrayOfStr[i].length() - arrayOfStr[i].indexOf("=")) ));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;		nameList.add(extract);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;		//System.out.println(extract);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;	}&lt;/P&gt;&lt;P&gt;	&amp;nbsp;&amp;nbsp;return nameList;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 20:27:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-access-column-names-in-a-schema/m-p/2347944#M115133</guid>
      <dc:creator>aaronrums</dc:creator>
      <dc:date>2023-06-05T20:27:01Z</dc:date>
    </item>
  </channel>
</rss>

