Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
dhasharadh
Creator III
Creator III

how macros work ? do they execute after the reload or before the reload ??

Dear all, 

struggling with crazy behaviour of macros. 

wrote a macro to trigger a button and in that button wrote 2 other actions which which will trigger another 2 macros written to export a chart to csv format. 

1st macro to trigger a button A

second macro to export chart  XYZ  ( This export action was given to button A only)

3rd macro is also to export an other chart DEF  ( This export action was given to button A only)

Not sure whats going wrong, but both charts are some times exporting entire data without any filters and some times few records but both exported files are showing the same data. 

@Miguel  @jagan  can any of you shed some light on this pls..

@

Please help me out. Thanks

Labels (1)
4 Replies
marcus_sommer

Actions aren't executed sequentially else completely in parallel and depending on how Qlik and the OS queued the handles and/or how long the different actions need to finish you may get different results - they have no dependencies to each other.

Therefore it's rather unlikely that you will get a stable solution with this approach.  IMO it's more complicated as necessary. Just put everything in a single macro. Further make sure that you have enough WaitForIdle statements (forced Qlik to wait until all calculations are finished before doing the next step) and Sleep statements (to ensure that the OS + your storage/network has enough time to perform any file-operations) within your routine (depending on your task it may also be useful to implement any check-routines and/or error-handles).

- Marcus

dhasharadh
Creator III
Creator III
Author

Thanks Marcus for your time, 

here is the full requirement please guide us with procedure. 

we have a table box with 12 columns ( which is sorted on priority) and out of which only first column we want to export it in txt format. 

and before exporting we have to make 2 set of selections ( after making the first set export -- then second set of selection then export ) so its like 2 sets and 2 macros has to be written to make the files get export.

after making the selections that first column in the table box has to export. 

Challenges :  when exporting from table box, we are adding that field into export option using a button but there is no sort option and values are mixed together and giving unique records. 

if i use straight table and added all the 12 columns and applied sorting then hided other columns except the first one and used to macro to export it, now comes the issue.

2 files are generated in the mentioned folder but both files contains same data, first set of selections are not working i guess or macro running fine ( based on the exported file name we can confirm that) file names are unique but both contains the same data which is related to second set of selections. 

Please guide us what is mistake that we are doing here. 

Thanks Much in advance..

marcus_sommer

It's not really clear for me what you are trying to do. Nevertheless I stay by my main-suggestion to reduce the number of trigger, actions and macros as far as possible - and to end probably by a single macro.

Each kind of selections could be done within the macro - which execute all statements sequentially - and if you want to export multiple datasets you could do it within a loop.

Beside this I have the impression that your task used a mix of actions and macros - it may work but if possible I would try to avoid it. Always with a careful check if there is really an added value to (partly) automate a task, if yes could I use actions, if not then using macros and only if this didn't full fill the requirements to mix the different features.

Further by the (manually or macro) export from an object I didn't notice that the object-order changed - therefore I assume that you tries everything else maybe by using an action for it respectively only exporting data which have no relation to an object and which then might output within the load-order.

Especially if you used macros you don't depend on the visible objects. Quite often it's useful to create a separate sheet with all those objects which should be exported or printed. Of course you need some extra work to create and maintain them but they could be specialized created/formatted for their job which means often much lesser work at all as to design sheets/objects which should serve various purposes.

- Marcus 

dhasharadh
Creator III
Creator III
Author

Thanks Much Marcus for your valuable time,

the below is what am trying to achieve.

select BM01 (Bookmark) and previous month ( to select prev month - use select in field option - field/column name is WellMonth and the exp Date(addmonths(Today()-1),'YYYY-MM')

Export the straight table (CH02) in txt format. ( file name should be YYYYMMDD_File1.txt )  then

clear all selections in the dashboard

select BM02 (Bookmark) and previous month ( to select prev month - use select in field option - field/column name is WellMonth and the exp Date(addmonths(Today()-1),'YYYY-MM') then

Export the straight table (CH04 )in txt format. ( file name should be YYYYMMDD_File2.txt )

Thanks Much in advance.