Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

qlikmeup
New Contributor

how to dynamically change a (bundle loaded) Image as a Background of a PivotTable in QlikView

I want to have a (bundle loaded) Image as a background of a pivot-table. But this image must change one some selections.

My_Images:

BUNDLE LOAD

  Area

  ,Image

  FROM

My_Pics.xlsx

(ooxml, embedded labels, table is Tabelle1);


(1) My first solution was to create a Text Object (TX01) set it to Image  - Fill - 
and use =INFO(Area) (or qmem://<bundled>/xxx.jpg) in the Text Field.
Then i placed this Text Object beneath my pivot (PI01) using appropriate transparency on the pivot.
This worked fine but on another monitor AND in WebView the Pivot Table has a bug - it chages it size - it's getting bigger.
(might be that row height - which i can't change in a property using pixel-settings leads to that behaviour)
So the stupid Pivot Table doesn't remain stable above of my Text Object :-(


(2) Because (1) failed i tryed to set the background Image of the Pivot per Visual Basic Script.
I can set it in the Editor - but per script?
On PivotTable (and some other charts) Background is not as simple to set as a 'Expression' in the TextBox.
Some API-Samples i found don't work too...
The code must be something like

  SET chartObject = ActiveDocument.GetSheetObject("PI01")

  SET oProps = chartObject.GetProperties  '-> IGraphProperties

  oProps.GraphLayout.Frame.Background.ImageBlob = ??? 
  ...
  chartObject.SetProperties oProps


I tryed to copy the image of a Text Object using that script - but no luck.
But i couldn't find any better hint.
One thread mentioned todo something like this - but there's no XElement in QlikView - Edit Module - VBscript:
---

XElement bmp = new XElement("Bmp");

bmp.Add(new XAttribute("enctype", "base64"));

bmp.Value = base64encodedFile;

XElement root = new XElement("QVTheme", new XElement("TextObjectProperties"

  , new XElement("Layout", bmp)));

string objFileName = Path.GetTempFileName();

root.Save(objFileName);

newObj.ApplyTheme(objFileName);

File.Delete(objFileName);

---

(btw: VbScript debugging in 'Edit Module' seems to be 'verry hard' + API-Docu is also 'not the best')

So maybe there's another solution how to get it done that 2 controls remain stable above each other (Container??).
Or set Positions + widh + height per script -

  SET pivtObject = ActiveDocument.GetSheetObject("PI01")

  SET tximgObject = ActiveDocument.GetSheetObject("TX01")

  pivtPos = pivtObject.GetRect

  tximgPos = tximgObject.GetRect

  tximgObject.SetRect pivtPos

works - but on what event? - and that doesn't seem to work in webview at all...
Or this qlikview bug that Pivot Table changes it's size in webview or on other monitors is fixed? (my version is 11.20. SR15)
Would be happy for any hints

3 Replies
qlikmeup
New Contributor

Re: how to dynamically change a (bundle loaded) Image as a Background of a PivotTable in QlikView

Additionally there's a 2nd problem, when trying to use 'set Positions + widh + height per script' as said above.
If the pivot has set the property 'Layout' - 'Size to Data' this doesn't change the rect someone get's when calling

pivtObject.GetRect.
Yes the control itself looks nicer but the size it tells to others it has remains the same.
Someone can see this, when looking at 'Caption'-tab-'left lower corner - settings.
Width and Height seem to remain unchanged where anyone would expect them to deliver the visual Width and Height.
If the pivot has NOT set the property 'Layout' - Size to Data - this also doesn't keep it free from changing it's size
on other monitors or WebView.
Any hint would be welcome...

qlikmeup
New Contributor

Re: how to dynamically change a (bundle loaded) Image as a Background of a PivotTable in QlikView

I did some further research on the misbehaving RowHeight of Pivots in WebView.

  1. When i use e.g. fontsize 8 pixel this on my monitor gives for the 'real pixelheight' in visual for both environments
    8 pixel per any character printed in a row.
  2. The thing that differs is that WebView uses 2 pixel LESS for the visual Height of a Row. WebView Rows of Pivots are drawn with (1 pixel) less Padding then Designer View. (i saw some other comments according to that topic that also reclaim less characters visible in WebView)

In my concrete Grid this means 17 Pixel row-height used in Designer are shrinking to 15 Pixel RowHeight shown in WebView. And i see no API or other way to prevent that.

This doesn't make sense - less visibility in WebView per design? - in my opinon that is a BUG...

qlikmeup
New Contributor

Re: how to dynamically change a (bundle loaded) Image as a Background of a PivotTable in QlikView

I've attached a sample now, to show the 'resize'-problem...

Community Browser