I need to insert same trigger for some fields (varying only field name). To do this "programmatically", I have try to search a property on API for trigger managing, but I have not been able to find it.
My objective is to create a master document trigger "on selecting" a field and duplicate it for other fields by code, or create it directy from code.
All this is for managing individually the subtotals in a report generator. For help users, my idea is preselect subtotals fields with the same selected in column tables, categorizated in some data type (product data, customers info, time period, ecc...). For this I would use a document trigger bound to the field that select corresponding values on a parallel table containing same values that are in column tables. On chart, the visualization of any dimension and measure depends from this last table.
I would control subtotals (by a macro triggered from a button) using the parallel tables that are preselected with all dimensions selected from first tables, where users can deselect unwanted subtotals.
Are appreciated alternative solutions
Thanks in advance
You can try this.
Set Selections = ActiveDocument.Fields("Field1").GetSelectedValues(10000)
I think you don't need this macro- and action-stuff for this and in general you should avoid it if possible: Macros are Bad. There are various approaches available how users could choose their dimensions and expressions for an object and if you want to extend it to features which are not directly conditionally controllable like subtotals / partial sums you create for each chooseable dimensions two - one one and one without the subtotals.
Is useful, but I have seen that using field selection triggered macros, they not run in full browser mode. For this I used the shadow select suggested in Re: Forcing selection in listbox according to item selection in other listbox with macro.
Then, with a command button, in a macro I will scan columns of chart (pivot) to check if identifier is selected in subtotal tables and activate it if yes.
thanks for suggestion and links tha are very interesting; I will study them.
My dubt about 2 columns for measure approach is that if the user move a column, when apply subtotals the column is hide and is showed one which is in original position.
If you don't want that the users could move the columns you could disable these option within the tab presentation. But I think you should not much worry about it - qlikview is extremly easy to use and the basics, like they could move columns, expand/collapse columns and how they could find and select values and their meaning (logic of green, white and grey) are not very difficult (otherwise would be qlikview the wrong tool and maybe static pdf's more suitable).
the chart is a dynamic controlled pivot and the user has full control on it. For this, when the user move a column for grouping a dimension, if he/she enable subtotals on this column, it is probable that the pivot goes in a unwanted condition, hiding the moved column and showing another that is (if never moved) in original position...
Is for this reason that I have preferred macro for enable/disable subtotals.
Some years ago I have played with such macro-stuff on subtotals, formatting, column-widths and so on to be more flexible but it's complicated, won't work within AJAX client and slowed down the response-times and therefore didn't used it in productive (like above mentioned I use dimensions twice for one dimension to be able to switch between subtotal or not and it worked well).