Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Dynamic container with tableBox inside

Good day everyone.

I have next issue.

As Data source I have qvd file with next structure

License Plate | Start Point | Destination |


AAAAA Start Point1Destination point 1
AAAAA Start Point2Destination point 2
AAAAAStart Point3Destination point 3
BBB Start Point4Destination point 4
BBB Start Point2Destination point 2
BBBStart Point5Destination point 6

For each license plate should be created separate table Box and all table boxes should be inside one container.

I was trying to create one TableBox with all information and after inside VB script for each License plate create separate table and put this table in ContainerBox.

Unfortunately I did not found any possibility to get just part of rows from General table and Paste it into new one.

From other side I also tried to run macro from load script.

Idea was to go through all license plates inside load script and for each part of datasource call VB macro which creates a table based on that part of datasource.

but still any success

Problem is that macro did not starts from load script.

Does anyone have any idea about this question?

4 Replies
Valued Contributor II

Re: Dynamic container with tableBox inside

Regarding running macro from loadscript. It doesn't work in Publisher if you have a macro that needs system access.

Not applicable

Re: Dynamic container with tableBox inside

Step one would be, in my opinion, to create for each License Plate a seperate table in your datamodel.


load Distinct

@1 as LicensePlate

Resident MainTable;

for i = 0 to NoOfRows('LPList')

Let vLplate = peek('LicensePlate', $(i), 'LPList');

Trace ========================$(vLplate);


load * Resident Table where @1 = '$(vLplate)';

Maybe this will help you get further.

Re: Dynamic container with tableBox inside

Here is a possible approach.

1. Create several Straight Table charts (not table boxes) in your container. Call them Lic1, Lic2, etc.

2. In the script assign to the unique License numbers to variables vLic1, vLic2, etc.

3. In the charts, use a calculated dim of


4. Use conditional show to hide the charts that don't have vLicN value.

You will have to pre-create the max possible charts.


Not applicable

Re: Dynamic container with tableBox inside

Thank you Rod for the response.

Actually it might work.

What I've done is next:

1. - I created a listbox with $Table field

2. - For each item from this listbox I'm creating a separate pivot table inside VB Script

3. - And the last step should be like this - when table is being created it should be added to Container box, which was created in VB Script also. But here I met some difficulties.

Below you can see my VB Script code.

dim counter

sub GetAllItemsFromListBox

Set ContainerObj = ActiveDocument.Sheets("Main").CreateContainer

set ContProp=ContainerObj.GetProperties

ContProp.Frame.Name.v = "Selections"

ContProp.SingleObjectMode = 1

ContProp.SingleObjectStyle = 1

ContProp.ShowObjectTypeIcons = True

set lb = ActiveDocument.GetSheetObject( "LB01" )

h = lb.GetRowCount

counter =0

for RowIter=0 to h-1

     rem 2. Create charts for all tables in tableModel

     set chart = ActiveDocument.Activesheet.CreatePivotTable

     chart.AddDimension lb.GetCell(RowIter,0).Text&".@2"

     chart.AddDimension lb.GetCell(RowIter,0).Text&".@3"

     chart.AddExpression "["&lb.GetCell(RowIter,0).Text&".@4]"

     chart.AddExpression "["&lb.GetCell(RowIter,0).Text&".@5]"

     chart.AddExpression "["&lb.GetCell(RowIter,0).Text&".@6]"

     chart.AddExpression "["&lb.GetCell(RowIter,0).Text&".@7]"A

     set cp = chart.GetProperties

     cp.TableProperties.IndentMode = true  

     cp.TableProperties.NumberOfLeftDimensions = 2

     cp.GraphLayout.Frame.ObjectId = lb.GetCell(RowIter,0).Text        

     chart.SetProperties cp


     ContProp.ContainedObjects.Item(RowIter).Id = "Document\"&lb.GetCell(RowIter,0).Text&"]"

     ContProp.ContainedObjects.Item(RowIter).Text.v = "text"


ContainerObj.SetProperties ContProp

end Sub

Anyway we found other way for presenting data )

Thank all of you for the help

Community Browser