Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
fredericvillemi
Creator III
Creator III

Add the frequency in every listbox by script

Hi,

i'm trying to use some vbscript in Qlikview and i feel the model is quite difficult.

What i would like to do :

i want to open a document, list all the listboxes only and add the "Frequency in percent" to all of them.

I can't even find how to have an easy list of all listboxes in the document..

can you help me ?

Thanks

1 Solution

Accepted Solutions
danielrozental
Master II
Master II

Try something like this

sub abc()

    for j= 0 to ActiveDocument.NoOfSheets - 1

        set s=ActiveDocument.Sheets(j)

        lboxes=s.GetListBoxes

        for i=lbound(lboxes) to ubound(lboxes)

             set box=lboxes(i).GetProperties

             box.Layout.ShowFrequency = true

             box.Layout.FrequencyInPercent = true

             lboxes(i).SetProperties box

        next

    next

end sub

View solution in original post

4 Replies
danielrozental
Master II
Master II

Try something like this

sub abc()

    for j= 0 to ActiveDocument.NoOfSheets - 1

        set s=ActiveDocument.Sheets(j)

        lboxes=s.GetListBoxes

        for i=lbound(lboxes) to ubound(lboxes)

             set box=lboxes(i).GetProperties

             box.Layout.ShowFrequency = true

             box.Layout.FrequencyInPercent = true

             lboxes(i).SetProperties box

        next

    next

end sub

fredericvillemi
Creator III
Creator III
Author

that's excellent ! Thanks, very nice example.

And just one more thing : if i wanted to add expressions to my listbox, what is the syntax ?

addExpression doesn't seem to work with listboxes .. and properties.expressions.add seems not good ...

thanks

danielrozental
Master II
Master II

It was a hard one, took me a bit

    Set lst = b.GetSheetObject("LB03")

    Set c = lst.GetProperties.Expressions

    c.Add

    Set x = c.Item(c.Count - 1)

    x.Data.ExpressionData.Definition.v = "sum(SalesAmount*2)"

fredericvillemi
Creator III
Creator III
Author

great !

scripting is sometimes quite tricky but so powerful !

thanks Daniel