Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
samuel_brierley
Creator
Creator

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
jonathandienst
Partner - Champion III
Partner - Champion III

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
samuel_brierley
Creator
Creator
Author

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.