Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

pepe2209
Not applicable

Perform function 'for each' selected value in variable

Hello,

I am trying to write a macro that perform a  (sendReport) fuction for each value selected within a variable.

so for instance the variable has the following selections:

ID
ID 1
ID 2
ID 3
ID 4
ID 5

So I want to perform the sendReport function for each value in 'ID' (ID 2, ID 4, and ID5)

I was working on something like this for the macro:

sub ReportforeachID

Set oID = ActiveDocument.Fields("ID").GetSelectedValues

  for each item in oID

  sendReport

  next

  ActiveDocument.Save

  ActiveDocument.GetApplication.Quit

end sub

But this is not working, it brings me back to the adjust module screen. The sendReport function is working perfectly.

Your help would be much appreciated.

Regards Peter