<?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: Create Variable Field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925107#M320142</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it is possible for you to share your application or a smaller sample of it to illustrate the problem as a QVW and upload it - it would be much easier to help you... &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Sep 2015 13:37:05 GMT</pubDate>
    <dc:creator>petter</dc:creator>
    <dc:date>2015-09-10T13:37:05Z</dc:date>
    <item>
      <title>Create Variable Field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925102#M320137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following problem I cannot solve:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a Field with variable entries.&lt;/P&gt;&lt;P&gt;Eg: After some selections Field a has the &lt;STRONG&gt;possible&lt;/STRONG&gt; Values X, Y and Z. Now I want Field B to contain exactly these three values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="216" style="border: 1px solid rgb(0, 0, 0); width: 93px; height: 216px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Field A&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Z&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Y&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;X&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="text-decoration: line-through;"&gt;V (not possible Value)&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;W (np)&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;etc. (np)&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE border="1" class="jiveBorder" height="123" style="border: 1px solid rgb(0, 0, 0); width: 57px; height: 123px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Field B&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Z&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Y&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;X&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; What I tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a variable:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vCon = concat(Distinct [Field A],'/')&lt;/P&gt;&lt;P&gt;Script:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load subfield($(vCon),'/') as [Field B]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I get an error message when loading the script:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Error in expression:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;')' expected&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If I try without a variable it works, so i belive the error lies there.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Load subfield('Z/Y/X','/') as [TestField B]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Hope someone can help, thank you in advance&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Best regards&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 11:47:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925102#M320137</guid>
      <dc:creator />
      <dc:date>2015-09-10T11:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925103#M320138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The variable vCon has to be calculated in the UI ... It is not obvious from your question where it is created ...? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) In the UI as a create via some menu command?&lt;/P&gt;&lt;P&gt;2) As a line in the Load Script? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 13:00:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925103#M320138</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2015-09-10T13:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925104#M320139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response!&lt;/P&gt;&lt;P&gt;It is created in the UI (settings&amp;gt;variable overview&amp;gt;add)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 13:05:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925104#M320139</guid>
      <dc:creator />
      <dc:date>2015-09-10T13:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925105#M320140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two things that seem a bit odd:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Why is there no single quotation marks on each side of the $(vCon):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Load subfield($(vCon),'/') as [Field B]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error message shows single quotation marks - how did they get into the error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Why are you using the two parameter version of SubField and not the three parameter version?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The two parameter version will generate one row for each of the values in the vCon - is that what you want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The three parameter version picks out a specific subfield from the string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyhow I think:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load SubField(&amp;nbsp; '$(vCon)' , '/' ) AS [Field B] .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should be more correct with regards to the quotation marks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You don't show the entire load statement either - could you do that - with the FROM or RESIDENT clause?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 13:22:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925105#M320140</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2015-09-10T13:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925106#M320141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, as I tried to show above I would like to generate one row for each of the values.&lt;/P&gt;&lt;P&gt;If do it as you suggest, I get as a result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;= concat(Distinct [Field A],'&lt;/P&gt;&lt;P&gt;')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the quotation marks somehow prevent the variable to be calculated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 13:33:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925106#M320141</guid>
      <dc:creator />
      <dc:date>2015-09-10T13:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create Variable Field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925107#M320142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it is possible for you to share your application or a smaller sample of it to illustrate the problem as a QVW and upload it - it would be much easier to help you... &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 13:37:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Variable-Field/m-p/925107#M320142</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2015-09-10T13:37:05Z</dc:date>
    </item>
  </channel>
</rss>

