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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get all values ?

I use the following script to get all possible values  in vb macro

SET Field1 = Doc.Fields("CodeGroupe").GetPossibleValues

How could I get all values possible and exluded for a field ?

Labels (1)
2 Solutions

Accepted Solutions
Anonymous
Not applicable
Author

vList:

= concat({1} distinct Total CodeGroupe, ',')

and query them within the macro:

SET Field1 = Doc.Variables("vList").GetContent.String

View solution in original post

swuehl
Champion III
Champion III

Or maybe something like

SUB Test

Set  field = ActiveDocument.GetField("FieldName")

msgbox( field.GetCardinal )

for i = 1 to field.GetCardinal

  msgbox(ActiveDocument.Evaluate("=FieldValue('FieldName',"&i&")"))

next

END SUB

View solution in original post

6 Replies
marcus_sommer
MVP
MVP

I think the easiest way will be to create these list within a variable in the gui per:

vList:

= concat({1} distinct Total CodeGroupe, ',')

and query them within the macro:

SET Field1 = Doc.Variables("vList").GetContent.String

- Marcus

Anonymous
Not applicable
Author

vList:

= concat({1} distinct Total CodeGroupe, ',')

and query them within the macro:

SET Field1 = Doc.Variables("vList").GetContent.String

Anonymous
Not applicable
Author

how could I loop over each values in the list ?

swuehl
Champion III
Champion III

Or maybe something like

SUB Test

Set  field = ActiveDocument.GetField("FieldName")

msgbox( field.GetCardinal )

for i = 1 to field.GetCardinal

  msgbox(ActiveDocument.Evaluate("=FieldValue('FieldName',"&i&")"))

next

END SUB

marcus_sommer
MVP
MVP

You could create an array from this variable and loop through it, like:

...

arr = split(Field1, ",")

for i = 0 to ubound(arr) - 1

     xyz = arr(i)

     ....

next

....

- Marcus

yakir_manor
Contributor III
Contributor III

did a small qvw with a simple macro that works