Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am writhing a Macro.
How can I get the value of a selected field.
Also is there any documentation for writing a macro in Qlikview where I can find functions and Examples.
Regards
If you install your QlikView Desktop with "Complete" option you will find the documentation under <Program Files>QlikView\Documentation
- APIGuide.qvw - will show you how you can access QV Objects in Macro
Also, the Help of QV Desktop might give you some guidance as well.
As to how to access the selected value/s, you can use ActiveDocument.Fields(<Field Name>).GetSelectedValues method. Please refer to API Guide for details.
I hope this helps.
Thanks for your reply... The API guide is really helpful
However, I am struggling in implementing the GetSelectedValues Function.
Can you please give me an example.
Thanks.
sub theFieldValues
set myfield = ActiveDocument.Fields("EmployeeName").GetPossibleValues
for each emps in myfield
msgbox(emps.String)
next
end sub
Hello Shubhasheesh,
I tried running your code but it is throwing an error.
Can you please provide me with an alternative code.
Thanks.
I got this correct:
sub theFieldValues
set v = ActiveDocument.Variables("a")
set myfield = ActiveDocument.Fields("MONTH_NUM").GetPossibleValues(1)
For i = 0 to myfield.Count-1
v.SetContent myfield.Item(i).text,true
next
end sub
Thanks
Try this:
sub theFieldValues ()
ActiveDocument.Fields("EmployeeName").Clear
set myfield = ActiveDocument.Fields("EmployeeName").GetPossibleValues
for i=0 to myfield.count-1
K = myfield.Item(i).Text
msgbox K
next
end sub
Nicole