3 Replies Latest reply: Apr 16, 2013 12:27 PM by Bill Britt RSS

    AJAX with OnOpen macro

      Hi,

      I have problem with OnOpen macros triggering selections and locking them, default preselection.

      When I open it in IE-plugin it just select and lock normally, in QV developer works great too, but not in AJAX client. In AJAX it looks like it reduce the data based on selection. (e.g. I have filter 'Yes', 'No' and in AJAX there is only one possible[not selected, even not locked] value 'No').

      It's not working in QVS 10 SR1, but in QVS 9 SR4 it works normally. Is there some special settings somewhere to force it running?

       

        • AJAX with OnOpen macro
          Erich Shiino

          I used the same trigger on the same environment and it worked for me. Can you send us a small sample where you can get this error?

          Rgds,

           

          • Re: AJAX with OnOpen macro

            Do you resolve this? i have the same problema with QV11

            • Re: AJAX with OnOpen macro
              Bill Britt

              See the below. I know it is long but it will answer your question.

               

               

               

              So the appropriate section is 30.7 Document Properties: Triggers

              On the Triggers tab, it is possible to set actions (including macro actions) to be invoked on document
              events, variable events and field events. For more information on macros, see the Edit Module (page 885).
              Not all actions can be invoked from the following event triggers. Read more about the different actions
              under Add Action Dialog (page 541).

              Note!
              There are limitations as to the behavior of certain macro triggers when working with documents on Qlik-
              View Server. Please study the section Using Macros in QV Documents on the QV-Server (page 893) before
              designing server documents with macro triggers.

              Document Event Triggers:
              In this group actions are set to trigger on selected events in the document. An
              event has to be selected in the list before it is possible to assign actions or macros
              to it.


              OnAnySelect
              Select this event to assign an action to be executed each time a selection has
              been made in any field of the QlikView document.


              OnOpen
              Select this event to assign an action to be executed each time the QlikView
              document is opened. This event is not supported when running in the AJAX
              client.


              OnPostReduceData
              Select this event to assign an action to be executed after each time the Reduce
              Data command has been executed.


              OnPostReload
              Select this event to assign an action to be executed each time the script has
              been re-executed.


              Add Action(s)
              This button opens the Actions (page 540) page. On this page it is possible to
              add an action to the trigger. Choose the action macro to assign an existing
              macro name or type any name for which a macro can be created later in the
              Edit Module (page 885) dialog.
              The action will be executed each time the selected document event occurs.
              When an action has been assigned to the event, the button changes to Edit
              Action and it is possible to change the action for the event.

               

              Field Event Triggers:
              In this group actions are set to trigger on changes in the logical state of a specified
              field in the document. Select a field in the list and press one of the buttons
              to assign an action to in it. The buttons open the Actions (page 540)
              page. Here it is possible to assign an action, including an existing macro
              name, or type any name for which a macro can be created later in the Edit
              Module (page 885) dialog. For more information about adding actions, see
              Actions (page 540).
              When an action has been assigned to the field, the button changes to Edit
              Action. The following Field Event Triggers exist:


              OnSelect
              The action will be executed each time a selection has been made in the specified
              field.


              OnLock
              The action will be executed each time the field is locked.

              OnChange
              The action will be executed each time a selection has been made in any field
              which is logically associated with the specified field.

              OnUnlock
              The action will be executed each time the field is unlocked

              Variable Event Triggers:
              In this group you can set actions to trigger on changes in the contents of a
              specified variable in the document.
              Select a variable in the list and press one of the buttons to assign an action to
              it. The buttons open the Actions (page 540) page. On this page you can add
              an action to the trigger. Choose the action macro to assign an existing macro
              name or type any name for which you later can create a macro in the Edit
              Module dialog. For more information about adding actions, see Actions (page
              540).
              When an action has been assigned to the variable, the button changes to Edit
              Action and you can change the action for the event. The following Variable
              Event Triggers exist:

              OnInput
              The action will be executed each time a new value is directly entered in the
              selected variable.

              OnChange
              The action will be executed each time the value of the selected variable
              changes as a result of changes in other variables or the logical state of the document.
              This typically applies when the variable contains a formula.

               

              Note!
              For backward compatibility to earlier versions of QlikView, the action must consist of a macro action. An
              action that consists of only one macro action is translated back to old string format on save.

               

              Note!
              Actions that trigger other actions, so called cascading actions, may cause unforeseen consequences and are
              not supported!

               

              Section 39.3 Actions:
              On this page actions can be set for certain objects:
              • buttons
              • text objects
              • gauges
              • line/arrow objects
              Actions include launching an external application or exporting data from QlikView.
              Add Opens the Add Action Dialog (page 541) where the actions for the object are
              chosen. Choose the type of action in the lists. Depending on the action, different
              parameters for the action will appear on the Actions page. The actions
              will be executed in the order in which they appear in the list.
              Delete Removes the action from the object.
              Promote Moves the selected action up in the list of actions.
              Alternate State Sets the state that the action refers to. This setting is only relevant for actions
              related to selections or bookmarks.

              Selection
              Select in Field Selects the values and fields that are specified. In the Search String you can
              specify a search mask, e.g. (A|B) will select both A and B.
              Select Excluded Selects the excluded values in the specified field.
              Select Possible Selects the possible values in the specified field.
              Toggle Select Toggles between the current selection and the specified Field and Search
              String. In the Search String you can specify a search mask, e.g. (A|B) will
              select both A and B.
              Forward Goes one step forward in the list of selections.
              Back Goes back one step in the list of selections.
              Pareto Select Makes a pareto selection in the specified field based on an expression and percentage.
              This type of selection is used to select the top contributors to a measure,
              typically in line of a general 80/20 rule. For example, to find the top
              customers that contribute to 80% of the turnover, Customer should be used as
              field, sum(Turnover) should be used as expression and 80 should be used as
              percentage.
              Lock Field Locks the selections in the specified field.
              Lock All Locks all values in all fields.
              Unlock Field Unlocks the selections in the specified field.
              Unlock All Unlocks all values in all fields.
              Unlock and Clear All Unlocks all values and clears all selections in all fields.
              Clear Other Fields Clears all related fields except the one specified.
              Clear All Clears all selections except locked ones.
              Clear Field Clears a specific field.
              Copy State Contents Copies the selection from the Source State to the Target State. Only available
              when alternate states have been defined.
              Swap State Contents Swaps the selections between State 1 and State 2. Only available when alternate
              states have been defined.

               

              Layout


              Activate Object Activates the object specified by Object ID. This function does not work in
              Ajax client.
              Activate Sheet Activates the sheet specified by Sheet ID.
              Activate Next Sheet Opens the next sheet in the document.
              Activate Previous
              Sheet
              Opens the previous sheet in the document.
              Minimize Object Minimizes the object specified by Object ID.
              Maximize Object Maximizes the object specified by Object ID.
              Restore Object Restores the object specified by Object ID.
              Set State Name Applies the specified State to the object specified by Object ID. Only available
              when having defined alternate states.

              Bookmark
              Apply Bookmark Applies a bookmark specified by Bookmark ID. If two bookmarks have the
              same ID, the document bookmark is applied. To apply the server bookmark
              specify Server\bookmarkID.
              Create Bookmark Creates a bookmark from the current selection. Specify Bookmark ID and
              Bookmark Name. Select Hidden to create a hidden bookmark.
              Replace Bookmark Replaces the bookmark specified by Bookmark ID with the current selection.

               

              Print
              Print Object Prints the object specified by Object ID. Specify the Printer name if the
              object should be sent to another printer than the default printer. (Not available
              as document and sheet trigger.)


              Print Sheet Prints the sheet specified by Sheet ID. (Not available as document and sheet
              trigger.) This function does not work in AJAX client.


              Print Report Prints the report specified by Report ID. Specify the Printer name if the
              report should be sent to another printer than the default printer. Mark the
              check box Show Print Dialog if you want the Windows print dialog to be
              shown. (Not available as document and sheet trigger.)

              External
              Export Exports a table containing a specific set of fields, but only those records that
              are applicable according to the made selection are exported. Click on the
              Setup button on the Actions page to open the Export Action Settings dialog.
              (not available as document and sheet trigger)
              Launch Launches an external program. The following settings can be configured in the
              Actions dialog:
              Application
              Click on Browse... to find the application that should be launched. (Not available
              as document and sheet trigger.)
              Filename
              Enter the path to the file that should be opened with the application specified
              above. (Not available as document and sheet trigger.)
              Parameters
              Specify parameters for the command line from which the application is started.
              (Not available as document and sheet trigger.)
              Working Directory
              Sets the working directory for the application to be launched. (Not available
              as document and sheet trigger.)
              Exit application when QlikView is closed
              Forces the application to be closed when QlikView is exited. (Not available as
              document and sheet trigger.)
              This function does not work in AJAX client.
              Open URL Opens the URL in the default web browser. (Not available as document and
              sheet trigger.)
              Open QlikView Document
              Opens the specified document. The file extension must be included. (Not available
              as document and sheet trigger.)
              Mark the check box Transfer State to transfer the selections from the original
              document to the one you wish to open. The opened document will first be
              cleared of selections.
              Mark Apply state on top of current to retain the second document’s selections
              and apply the original document’s selections on top of them.
              Open in same Window opens the new document in the same browser tab
              when using the AJAX ZFC client.
              Run Macro Enter the path and name of the macro to be run. Type any name for which it is
              possible to later create a macro in the Edit Module dialog, or a calculated
              expression for dynamic update.
              Set Variable Assigns a value to the specified variable.
              Show Information Shows the associated information, such as a text file or an image for the field
              specified by Field. This function does not work in AJAX client.
              Close This Document Closes the active QlikView document.
              Reload Performs a reload on the current document. This function does not work in
              AJAX client.

               

              Dynamic Update Performs a dynamic update of the data in the currently loaded document. The statement for
              the dynamic update is to be entered in the Statement field.
              The intended usage of Dynamic Update allows a QlikView Administrator to feed limited
              amounts of data in to a QlikView document from a single source without running a reload of
              the document. Analysis can then be performed by multiple clients connecting to the Qlik-
              View Server.
              Note! The uploaded information is stored in RAM only so any data added or updated using
              Dynamic Update will be lost if a reload of the document is performed.
              The following grammar describes the possible statements and their components that can be
              used with the Dynamic Update feature:
              l statements ::= statement { “;” statement }
              l statement ::= insert_statement | update_statement | delete_statement | begin_transaction_
              statement | commit_transaction_statement
              l insert_statement ::= "INSERT" "INTO" ("*" | table_name) field_list "VALUES"
              value_list {"," value_list} ["KEY" ["AUTO" | (" (" field_list ")")] ["REPLACE"
              (["WITH" "ONE"] | "EACH") ]]
              l update_statement ::= "UPDATE" ("*" | table_name) set_clause {"," | set_clause}
              "WHERE" condition ["AUTO" "INSERT"]
              l delete_statement ::= "DELETE" "FROM" ("*" | table_name] "WHERE" condition
              l begin_transaction_statement ::= "BEGIN" ("TRANSACTION" | "TRAN") [trans_
              name]
              l commit_transaction_statement ::= "COMMIT" ["TRANSACTION" | "TRAN"]
              [trans_name]
              l table_name ::= identifier | quoted_name
              l field_list ::= "(" field_name {"," field_name} ")"
              l value_list ::= "("value {"," value} ")"
              l set_clause ::= "SET" field_name "=" any_valid_non_aggregated_qlikview_expression
              l field_name ::= identifier | quoted string
              l value ::= identifier | any_qlikview_number | quoted string
              l condition ::= any_valid_non_aggregated_qlikview_expression
              l identifier ::= any_qlikview_identifier
              l quoted_string ::= "[" [^]]+ "]"
              Example:
              UPDATE AbcTable SET Discount = 123 WHERE AbcField=1
              Note! To use this feature, Dynamic Update must be allowed both on the Document and on
              the Server.

              Note!
              Actions that trigger other actions, so called cascading actions, may cause unforeseen consequences and are
              not supported!

              Note!
              There are limitations as to the behavior of certain macro triggers when working with documents on Qlik-
              View Server. Please study the section Using Macros in QV Documents on the QV-Server (page 893) before
              designing server documents with macro triggers.

               

               

              Bill