Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jagannalla
Partner - Specialist III
Partner - Specialist III

Display the contents of variable one after another

Hi,

Can anyone help me in this macro code...

I've a variable vDisplay with three contents( i.e vDisplay=A,B,C). I want to show in message box all this contents through macro code. To achive this, first i had taken another variable to count of this contents by help of SubStringCount(i.e vCount=SubStringCount(vDisplay,',') it returns 2. This helps me for iteration purpose. But i'm not able to display A,B,C one after the another. The below macro code is what i developed...

Sub Display

   set vCount=ActiveDocument.Variables("vCount")

  set vDisplay=ActiveDocument.Variables("vDisplay")

          for i=0 to vCount.GetContent.String

               msgbox(vDisplay.Item(i).Text)

         next

End Sub

2 Replies
lironbaram
Partner - Master III
Partner - Master III

hei

attach is an example

hope its helps you

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hi Liron,

Excellent job...Actually the think is i'm trying to add this contents to table box. But it is not working can you help me little bit more.

sub AddToTableBox

         

     set val=ActiveDocument.Variables("vCatchCount")

     set vFields=ActiveDocument.Variables("vFields")

      set TB = ActiveDocument.Sheets("Main").CreateTableBox

              

     for i=0 to val.GetContent.String

                  TB.AddField vFields.Item(i).Text

    next

end sub

- In the place of val.Item(i).Text...i'm trying to using your code displaying in messagebox.

- The above code works when we tried with fields data.

For Eg:

sub AddToTableBox

set val=ActiveDocument.Fields("F1").GetPossibleValues

set TB = ActiveDocument.Sheets("Main").CreateTableBox

for i=0 to val.Count-1

'msgbox(val.Item(i).Text)

TB.AddField val.Item(i).Text

next

end sub