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: 
Not applicable

Get Field row

Hi, I have troubles with a VBscript function.

The function would have to print all the elements of a field, but I cannot find the right function.

sub print

set fld = ActiveDocument.GetField("Name")

msgBox("The field has" &fld.GetCardinal& "elements") 'with this, I know the number of the elements

(loop)

...

set i=0

msgBox("The" & i & "elements is: ", ?????.text) ' What's the function? <<======

set i=i+1

...

...

(end loop)

end sub

Thanks

Labels (1)
6 Replies
Not applicable
Author

From the APIGuide:

set val = ActiveDocument.Fields("Name").GetSelectedValues
for 1 = 0 to val.Count - 1
MsgBox(val.Item(i).Text)
next


The Class is IArrayOfFieldValue.

Not applicable
Author

Try fld.Item(i).Text

Talha

Not applicable
Author

That won't work, because fld is pointed to a Field class and that class does not have an Item member.

fld.GetSelectedValues.Item(i).Text may work directly in your message box.

rwunderlich
MVP
MVP

I don't see a member of Field that returns ALL the values if that's what you are after. However, you can use Evaluate to call the Qlikview FieldValue function.

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

-Rob

Not applicable
Author

Rob, you are right, I don't want to use the "getselectedvalues" function, because I want to make a function indipendent from the user selection; besides, the "Item" function doesn't work.

Thank you, I'll try soon the Evaluate method.

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

GetPossibleValues() is another alternative

Ask me about Qlik Sense Expert Class!