Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
From the APIGuide:
set val = ActiveDocument.Fields("Name").GetSelectedValues
for 1 = 0 to val.Count - 1
MsgBox(val.Item(i).Text)
nextThe Class is IArrayOfFieldValue.
Try fld.Item(i).Text
Talha
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.
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
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.
GetPossibleValues() is another alternative