Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
jagannalla
Partner - Specialist III
Partner - Specialist III

Is it possible to hold bookmark name in variable?

Hi,

Is it possible to store bookmark name in variable?

- The think is i had a BookMarkObject by using bookmark object i can able to select book mark names. When i select any bookmark name i want to store in one variable.

Is it really possible to do it? Just i need answer otherwise if it is possible how can i overcome this.

16 Replies
jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Sorry D V to get back you lately... Actually i'm using personal edition i'm not able to open your qvw file. Can you say the steps please..

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Roland,

Thanks for your response sorry to get back you lately.  As per your code i can see only the name which i given for bookmark in input box(i.e., vBookVar). There is empty value in vBookMarkName variable it doesn't hold any value.

The think is when i select book mark name from bookmark object then i want to store the particular bookmark name in variable vBookMarkName.

Not applicable

Hi Jaqq.,

There is empty value in vBookMarkName variable it doesn't hold any value. --> yes, this is true. You never used it. In your "Save"-Button you coded "=vBookVar". So the Name is (correctly) within that var.

To see where and how you used your vars at all: see settings --> var overview and expression overview

RR

IAMDV
Master II
Master II

Here is the code...

You need to amend it based on your fields and this is just a starting point. you can improve it for sure.

Sub CurrentSelection()

Set MyCurrentSelection=ActiveDocument.GetCurrentSelections

S = MyCurrentSelection.Selections

MyVarID = MyCurrentSelection.VarId

    For i=lbound(S) to ubound(S)

        ActiveDocument.Variables("MyVar").SetContent S(i), true

    Next

    Set MyVariable  = ActiveDocument.Variables("vBM")

    MyBookMarks = ActiveDocument.GetDocBookmarkNames

    IF ActiveDocument.Variables("MyVar").GetContent.String = "A" Then

        bm = MyBookMarks(0)

        MyVariable.SetContent bm,True

    ElseIF ActiveDocument.Variables("MyVar").GetContent.String = "A, B" Then

         bm = MyBookMarks(1)

        MyVariable.SetContent bm,True

    ELSE

        bm = MyBookMarks(2)

        MyVariable.SetContent bm,True

     End IF

End Sub

* Note : Please run the code on "OnAnySelect" Event under Triggers and under Document Properties

Cheers - DV

IAMDV
Master II
Master II

Hi Jacq,

Have you got chance to get test this one? If it works please mark the post answered, it helps other users to reference back.

Thanks - DV

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

DV,

Sorry to get back you lately..

Actually i didn't get time to work on this. Ok i tried your code but i'm getting error message  Subscript out of range: '[number: 2]'

Capture.PNG

Not applicable

Helo DV I am using u code for current Bookmark selection

but showing always last else Part

and what about vBM and Myvar variables can u explain more about those variables in u code..

thanks

vas