Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Attend QlikWorld 2020 and hear keynote speaker, Malcolm Gladwell. Register by February 29th to save $200. Learn More
Highlighted
samuel_brierley
Contributor

actions running out of order (selection in field and macro)

This is confusing the hell out of me to be honest, hopefully someone can explain.

I have a button with 3 actions all work in isolation

1. filter to select 3 months ='>=' & MakeDate(Year(Now()), Month(AddMonths(Now(), -3)), 1) & '<=' & MakeDate(Year(Now()), Month(Now()), 1) 

2.a macro to export a load of stuff (works fine)

3. filter to last month =MakeDate(Year(Now()), Month(AddMonths(Now(), -1)), 1)

when I click the button the button is filtering just the last month and exporting those.

that makes no sense!!

thanks all

2 Replies
Highlighted
MVP
MVP

Re: actions running out of order (selection in field and macro)

Qlikview recalculates when a selection change is made and this happens asynchronously. Your action/macro runs synchronously so the table you are exporting might not have been updated yet. You will need to delay by using the WaitForIdle API

ActiveDocument.GetApplication.WaitForIdle

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Highlighted
samuel_brierley
Contributor

Re: actions running out of order (selection in field and macro)

Thanks for the advice but that didn't seem to help.

I put the code both at the start and end of each macro just to make sure and no good.

its not the end of the world as I can easily split up into multiple buttons but not the best solution.