<?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 Object FromXml Properties File in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287024#M106784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to add to this, this doesn't seem to work if the objects are on different layers, uBound always seems to return the object on the topmost layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Dec 2016 23:02:44 GMT</pubDate>
    <dc:creator>barryharmsen</dc:creator>
    <dc:date>2016-12-09T23:02:44Z</dc:date>
    <item>
      <title>Create Object FromXml Properties File</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287022#M106782</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 need to create a chart from xml properties file. Below code snippet will create chart but when try to assign object reference, i get "Macro parse failed functionality was lost"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ActiveDocument.Sheets(0).CreateObjectFromXmlPropertiesFile "C:\Qlikview\top10+discrepancies.xml"&amp;nbsp; // this works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set chart1 = ActiveDocument.Sheets(0).CreateObjectFromXmlPropertiesFile "C:\Qlikview\top10+discrepancies.xml"&amp;nbsp; //Macro parse failed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest any alternative way to achive above &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Padmasali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Dec 2011 05:01:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287022#M106782</guid>
      <dc:creator />
      <dc:date>2011-12-08T05:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create Object FromXml Properties File</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287023#M106783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you've noted, CreateObjectFromXmlProperties file has no return value. From past testing, I've found that the new object is always added as the first object in the collection. I've never verified that this will always be true, but I've had success with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;﻿ActiveDocument.ActiveSheet.CreateObjectFromXmlPropertiesFile "somefile"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;sObjects = ActiveDocument.ActiveSheet.GetSheetObjects&amp;nbsp; 'Objects this sheet&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;set newObj = sObjects(uBound(sObjects))&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; ' Get first obj in collection&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://robwunderlich.com"&gt;http://robwunderlich.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Dec 2011 06:27:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287023#M106783</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-12-08T06:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create Object FromXml Properties File</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287024#M106784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to add to this, this doesn't seem to work if the objects are on different layers, uBound always seems to return the object on the topmost layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2016 23:02:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287024#M106784</guid>
      <dc:creator>barryharmsen</dc:creator>
      <dc:date>2016-12-09T23:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create Object FromXml Properties File</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287025#M106785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, found a reliable way to get the ID of the new sheet object, using a dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before creating the new sheet object, create a dictionary with all the objects in the sheet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14813252044716256 jive_text_macro" jivemacro_uid="_14813252044716256"&gt;
&lt;P&gt;' As we cannot get the ID for the newly copied sheet object, we need to keep&lt;/P&gt;
&lt;P&gt;' track of all existing sheet objects and check for the new one&lt;/P&gt;
&lt;P&gt;set objList = CreateObject("Scripting.Dictionary")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;for each sht in sheet.GetSheetObjects&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ' Just in case there are linked objects in the same sheet&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if not objList.exists(sht.GetObjectID) then objList.add sht.GetObjectID, 1&lt;/P&gt;
&lt;P&gt;next&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then after adding the object from the XML properties, run through all the sheet objects again, the one that isn't in the list is the new one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14813252640747315" jivemacro_uid="_14813252640747315"&gt;
&lt;P&gt;' Check the dictionary to get the new sheet object&lt;/P&gt;
&lt;P&gt;for each sht in sheet.GetSheetObjects&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ' If the object doesn't exist it must be the one we created&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if not objList.exists(sht.GetObjectID) then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; objList.Add sht.GetObjectID, 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; newObjId = sht.GetObjectID&lt;/P&gt;
&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;
&lt;P&gt;next&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this example, newObjId contains the ID of the new object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2016 23:15:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287025#M106785</guid>
      <dc:creator>barryharmsen</dc:creator>
      <dc:date>2016-12-09T23:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create Object FromXml Properties File</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287026#M106786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can we achieve the samething using Qlik OCX C# code.&lt;/P&gt;&lt;P&gt;I want to retrieve the object id of the newly added object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Apr 2017 08:52:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Object-FromXml-Properties-File/m-p/287026#M106786</guid>
      <dc:creator />
      <dc:date>2017-04-20T08:52:45Z</dc:date>
    </item>
  </channel>
</rss>

