<?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 read and change fieldnames based on expression during load in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252177#M1179566</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Im sorry, this was a missunderstanding.&lt;/P&gt;&lt;P&gt;the example i provided was a bit misleading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im not looking for a crosstable statement or a string function. this wouldnt be the problem (there are tons of examples for this here)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im looking for something like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Right(tempBuilding,1) as Building,"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the source should be the field name (tempBuilding) and not the content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;something that just reads the number from the name of the field &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET Numfield= Right(field7,1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like &lt;/P&gt;&lt;P&gt;Right(test_table,1) , so its gets the last digit (or char) of every fieldname in "test_table"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im sorry for the missunderstanding.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Feb 2012 11:42:31 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-02-10T11:42:31Z</dc:date>
    <item>
      <title>read and change fieldnames based on expression during load</title>
      <link>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252174#M1179563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i was searching in the reference guide for some expression that reads the fieldname like other expressions read the content of the field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;f.e. thre are filds like&amp;nbsp; building1, building2, building3&lt;/P&gt;&lt;P&gt;the goal is, to change the format from &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;building1, value&lt;/P&gt;&lt;P&gt;23, temp&lt;/P&gt;&lt;P&gt;80, moist&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;building, b_number, value&lt;/P&gt;&lt;P&gt;23, 1, temp&lt;/P&gt;&lt;P&gt;80, 1, moist&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is it possible to read these like &lt;/P&gt;&lt;P&gt;right(anyfildname,1) to get the numbers (1,2,3 ec.) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if so, it could be possible to used in an expression like this:&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;LET b_number = right_fieldnames(1);&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;&lt;/CODE&gt;OR&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;LET b_number = &lt;/CODE&gt;IF (left_fieldname(5)='build', right_fieldnames(1));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is something like this possible ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 15:34:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252174#M1179563</guid>
      <dc:creator />
      <dc:date>2012-02-03T15:34:26Z</dc:date>
    </item>
    <item>
      <title>read and change fieldnames based on expression during load</title>
      <link>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252175#M1179564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Alexander&lt;/P&gt;&lt;P&gt;You can achieve this using cross table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wrote a sample script as an example. In this piece of code, I wrote a table using inline and store, but you can start from the second step, using crosstable on your original tables: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Creation of Test Table&lt;/P&gt;&lt;P&gt;Test:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; STUDY, TYPE, BUIDING1, BUILDING2, BUILDING3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, A, 200, 300, 400&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, B, 100, 50, 20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, C, 15, 90, 400&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, A, 15, 32, 200&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, B, 200, 100, 150&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, C, 50, 100, 70&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Store Test into Test.qvd;&lt;/P&gt;&lt;P&gt;drop table Test;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;//QVDs will be read to simulate a source file&lt;/P&gt;&lt;P&gt;//Cross table could be done in the original Load Inline&lt;/P&gt;&lt;P&gt;tempBuildings:&lt;/P&gt;&lt;P&gt;CrossTable(tempBuilding, Value, 2)&lt;/P&gt;&lt;P&gt;LOAD STUDY,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BUIDING1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BUILDING2,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BUILDING3&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[Test.qvd]&lt;/P&gt;&lt;P&gt;(qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//At this point tempBuildings has the Fields: STUDY, TYPE, tempBuilding and Value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Building:&lt;/P&gt;&lt;P&gt;Load STUDY,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE, Right(tempBuilding,1) as Building,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value&lt;/P&gt;&lt;P&gt;resident tempBuildings;&lt;/P&gt;&lt;P&gt;drop table tempBuildings;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 16:48:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252175#M1179564</guid>
      <dc:creator>erichshiino</dc:creator>
      <dc:date>2012-02-03T16:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: read and change fieldnames based on expression during load</title>
      <link>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252176#M1179565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes it is possible. See attachment. You should look in the help at the Crosstable statement and the string functions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 16:48:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252176#M1179565</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2012-02-03T16:48:20Z</dc:date>
    </item>
    <item>
      <title>read and change fieldnames based on expression during load</title>
      <link>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252177#M1179566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Im sorry, this was a missunderstanding.&lt;/P&gt;&lt;P&gt;the example i provided was a bit misleading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im not looking for a crosstable statement or a string function. this wouldnt be the problem (there are tons of examples for this here)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im looking for something like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Right(tempBuilding,1) as Building,"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the source should be the field name (tempBuilding) and not the content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;something that just reads the number from the name of the field &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET Numfield= Right(field7,1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like &lt;/P&gt;&lt;P&gt;Right(test_table,1) , so its gets the last digit (or char) of every fieldname in "test_table"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im sorry for the missunderstanding.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Feb 2012 11:42:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252177#M1179566</guid>
      <dc:creator />
      <dc:date>2012-02-10T11:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: read and change fieldnames based on expression during load</title>
      <link>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252178#M1179567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt;Not quite sure I understand... when you write your Load statement, then you know the field names, so you might as well hard-code the number in the script. Or what am I missing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt;Anyway, if you loop over the fields, then you can use the FieldNumber() and FieldName() functions, and in your case it could then be&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt;Right &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt;FieldName&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt;(2, 'Table'),1) &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt;"&gt;Building &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Feb 2012 11:58:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/read-and-change-fieldnames-based-on-expression-during-load/m-p/252178#M1179567</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2012-02-10T11:58:17Z</dc:date>
    </item>
  </channel>
</rss>

