<?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 GetField Example from API Guide not working in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153594#M30569</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All -&lt;/P&gt;&lt;P&gt;Trying to get this working:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;set fld=ActiveDocument.GetField(1)&lt;BR /&gt;msgbox(fld.Name)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;What I think this is supposed to do is access the array of fields returned by the load script by index number rather than by name. What actually happens is:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-613_sourceID:613" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Executing the code this way proces the desired result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;sub create_chart2()&lt;BR /&gt; set fld = ActiveDocument.GetField("Product")&lt;BR /&gt; txtName = fld.Name&lt;BR /&gt; msgbox(txtName)&lt;BR /&gt;end sub&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I off target by assuming that the Example in the API Guide for GetFiel is using an array index?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Nov 2009 00:22:20 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-11-17T00:22:20Z</dc:date>
    <item>
      <title>GetField Example from API Guide not working</title>
      <link>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153594#M30569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All -&lt;/P&gt;&lt;P&gt;Trying to get this working:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;set fld=ActiveDocument.GetField(1)&lt;BR /&gt;msgbox(fld.Name)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;What I think this is supposed to do is access the array of fields returned by the load script by index number rather than by name. What actually happens is:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-613_sourceID:613" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Executing the code this way proces the desired result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;sub create_chart2()&lt;BR /&gt; set fld = ActiveDocument.GetField("Product")&lt;BR /&gt; txtName = fld.Name&lt;BR /&gt; msgbox(txtName)&lt;BR /&gt;end sub&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I off target by assuming that the Example in the API Guide for GetFiel is using an array index?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 00:22:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153594#M30569</guid>
      <dc:creator />
      <dc:date>2009-11-17T00:22:20Z</dc:date>
    </item>
    <item>
      <title>GetField Example from API Guide not working</title>
      <link>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153595#M30570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As far as I understand, the example may be wrong, as you can access objects in two ways. One is referencing the object by name (as you did in your code example), and the other would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;sub create_chart2()&lt;BR /&gt; set fld = ActiveDocument.Fields(1)//change number/reference to get the number in the object array&lt;BR /&gt; txtName = fld.Name&lt;BR /&gt; msgbox(txtName)&lt;BR /&gt;end sub&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 00:34:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153595#M30570</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2009-11-17T00:34:01Z</dc:date>
    </item>
    <item>
      <title>GetField Example from API Guide not working</title>
      <link>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153596#M30571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately that gives me the same error:&lt;/P&gt;&lt;P&gt;Object required:'fld'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 00:41:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153596#M30571</guid>
      <dc:creator />
      <dc:date>2009-11-17T00:41:31Z</dc:date>
    </item>
    <item>
      <title>GetField Example from API Guide not working</title>
      <link>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153597#M30572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;EDIT: Sorry, I misunderstood your post. You want to use the field array. Please ignore. &lt;IMG alt="Big Smile" src="http://community.qlik.com/emoticons/emotion-2.gif" /&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;sub create_chart2()&lt;BR /&gt; set fld = ActiveDocument.Fields("Product")&lt;BR /&gt; txtName = fld.Name&lt;BR /&gt; msgbox(txtName)&lt;BR /&gt;end sub&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;It seems there are a few ways to reference fields. There was a brief discussion in one of these threads a while back, but I don't think anyone came up with a difference.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 00:50:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153597#M30572</guid>
      <dc:creator />
      <dc:date>2009-11-17T00:50:15Z</dc:date>
    </item>
    <item>
      <title>GetField Example from API Guide not working</title>
      <link>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153598#M30573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So if it is impossible to reference a loadscript field by array index, is there any way to dynamically create a chart that displays all fields loaded in the script?&lt;/P&gt;&lt;P&gt;The manual adding would be a deal breaker as it would more or less require a huge manual effort to add each field through the wizard, every time we wanted to consider a different table...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 00:57:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153598#M30573</guid>
      <dc:creator />
      <dc:date>2009-11-17T00:57:58Z</dc:date>
    </item>
    <item>
      <title>GetField Example from API Guide not working</title>
      <link>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153599#M30574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Digging around the API Guide, I found something that may work, but it's a little messier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sub Test&lt;BR /&gt; set flds = ActiveDocument.GetFieldDescriptions&lt;BR /&gt; for i = 0 to flds.Count - 1&lt;BR /&gt; set fld = flds.item(i)&lt;BR /&gt; if not fld.IsSystem then&lt;BR /&gt; txtName = fld.Name&lt;BR /&gt; msgbox(txtName)&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt;End Sub&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;That allows you to loop through every field. Unfortunately, that loop gets you System Fields, so I added the IsSystem check to check for those.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 01:03:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153599#M30574</guid>
      <dc:creator />
      <dc:date>2009-11-17T01:03:25Z</dc:date>
    </item>
    <item>
      <title>GetField Example from API Guide not working</title>
      <link>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153600#M30575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all, NMiller got it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 01:28:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153600#M30575</guid>
      <dc:creator />
      <dc:date>2009-11-17T01:28:42Z</dc:date>
    </item>
    <item>
      <title>GetField Example from API Guide not working</title>
      <link>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153601#M30576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;wytworm wrote:there any way to dynamically create a chart that displays all fields loaded in the script?&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;The system field '$Field" contains a row for every field present in the document. $Field can be used in a chart. Is that what you are looking for?&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 13:27:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/GetField-Example-from-API-Guide-not-working/m-p/153601#M30576</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2009-11-17T13:27:19Z</dc:date>
    </item>
  </channel>
</rss>

