<?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: Change expressions inside a container in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Change-expressions-inside-a-container/m-p/1694281#M726654</link>
    <description>&lt;P&gt;OK, maybe the question was too verbose, so I'll try to put it as simple as possible.&lt;/P&gt;&lt;P&gt;How do we reach the expressions of charts and tables, placed inside containers? Enumeration of all the objects on the sheet (&lt;STRONG&gt;For j = lBound(Objects) To uBound(Objects)&lt;/STRONG&gt;) doesn't reveal them - only stand-alone charts and tables.&lt;/P&gt;&lt;P&gt;For simplicity's sake - let's suppose we just want to see the expressions (from VBScript). For stand-alone charts and tables that's simple - but this simple approach doesn't work for those charts an tables inside containers.&lt;/P&gt;&lt;P&gt;I'm sure it ought to be possible - but I couldn't find any examples and wasn't able to make it up on my own.&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;</description>
    <pubDate>Fri, 17 Apr 2020 00:08:48 GMT</pubDate>
    <dc:creator>a_yershov</dc:creator>
    <dc:date>2020-04-17T00:08:48Z</dc:date>
    <item>
      <title>Change expressions inside a container</title>
      <link>https://community.qlik.com/t5/QlikView/Change-expressions-inside-a-container/m-p/1693871#M726653</link>
      <description>&lt;P&gt;Hello, everybody!&lt;/P&gt;&lt;P&gt;I've got a macro (VBScript) which programmatically changes certain expressions in charts and tables. Something like this (simplified):&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Objects = ActiveDocument.ActiveSheet.GetSheetObjects&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;For j = lBound(Objects) To uBound(Objects)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Set obj = Objects(j)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If obj.GetObjectType = 11 or obj.GetObjectType = 10 then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Set o = ActiveDocument.GetSheetObject(obj.GetObjectid)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Set cp = o.GetProperties&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;For k = 0 To cp.Expressions.Count - 1&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;OldExpr=cp.Expressions.Item(k).Item(0).Data.ExpressionData.Definition.v&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NewExpr=replace(OldExpr,"+","-")&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;cp.Expressions.Item(k).Item(0).Data.ExpressionData.Definition.v=NewExpr&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Next&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;o.SetProperties cp&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End if&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Next&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;It works fine for stand-alone charts and tables, but not for those put inside containers. I've tried to loop through objects inside containers - like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If obj.GetObjectType = 36 then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Set ContainerObj = ActiveDocument.GetSheetObject(obj.GetObjectId)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Set ContProp=ContainerObj.GetProperties&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;For l = 0 to ContProp.ContainedObjects.Count - 1 &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Set o = ContProp.ContainedObjects.Item(l).Def&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If o.GetObjectType = 11 or o.GetObjectType = 10 then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Set cp = o.GetProperties&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;For k = 0 To cp.Expressions.Count - 1&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;OldExpr=cp.Expressions.Item(k).Item(0).Data.ExpressionData.Definition.v&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NewExpr=replace(OldExpr,"+","-")&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;cp.Expressions.Item(k).Item(0).Data.ExpressionData.Definition.v=NewExpr&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Next&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;o.SetProperties cp&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End if&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Next&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;End if&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;but it throws an error "Object doesn't support this property or method: 'o.GetObjectType'". &lt;STRONG&gt;o.GetProperties&lt;/STRONG&gt; doesn't seem to work for &lt;STRONG&gt;ContainedObjects&lt;/STRONG&gt;, too. Tried it with or without &lt;STRONG&gt;Def&lt;/STRONG&gt; - no success.&lt;/P&gt;&lt;P&gt;How can I programmatically change expressions for all charts and tables - including those placed inside containers?&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-expressions-inside-a-container/m-p/1693871#M726653</guid>
      <dc:creator>a_yershov</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Change expressions inside a container</title>
      <link>https://community.qlik.com/t5/QlikView/Change-expressions-inside-a-container/m-p/1694281#M726654</link>
      <description>&lt;P&gt;OK, maybe the question was too verbose, so I'll try to put it as simple as possible.&lt;/P&gt;&lt;P&gt;How do we reach the expressions of charts and tables, placed inside containers? Enumeration of all the objects on the sheet (&lt;STRONG&gt;For j = lBound(Objects) To uBound(Objects)&lt;/STRONG&gt;) doesn't reveal them - only stand-alone charts and tables.&lt;/P&gt;&lt;P&gt;For simplicity's sake - let's suppose we just want to see the expressions (from VBScript). For stand-alone charts and tables that's simple - but this simple approach doesn't work for those charts an tables inside containers.&lt;/P&gt;&lt;P&gt;I'm sure it ought to be possible - but I couldn't find any examples and wasn't able to make it up on my own.&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 00:08:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-expressions-inside-a-container/m-p/1694281#M726654</guid>
      <dc:creator>a_yershov</dc:creator>
      <dc:date>2020-04-17T00:08:48Z</dc:date>
    </item>
  </channel>
</rss>

