Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

How to get the value of the selected field while writing a Macro

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

6 Replies
Highlighted
Not applicable

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.

Highlighted
Not applicable

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.

Highlighted
Not applicable

sub theFieldValues

set myfield = ActiveDocument.Fields("EmployeeName").GetPossibleValues

for each emps in myfield

msgbox(emps.String)

next

end sub

Highlighted
Not applicable

Hello Shubhasheesh,

I tried running your code but it is throwing an error.

Can you please provide me with an alternative code.

Thanks.

Highlighted
Not applicable

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



Highlighted
Contributor II
Contributor II

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