Event aquery_open_after

This event is used for representations, after the query URL has been analyzed. It allows the development partner to open additional tables. This query URL has the following format:

.../sdata/$$prod/FOLDER/CLASS?representation=REPRES&where='ID between "a" and "f"'&disp_summary=true

In this query, the class is given by CLASS, the representation by REPRES, a where condition has been given on the ID, and an additional parameter,disp_summary, has been set to true.

  • If the class is persistent, the tables declared in the class definition are already opened, but they can be completed or changed.
  • If the class is an Interface type, no table is opened and the development partner must open the tables.

Available variables

  • No current instance is defined. this is not available.
  • The tables that are declared in the class are opened, including technical classes such as those associated with translatable texts, opened with [F:ATX_N] abbreviations where N=1,2,3.
  • The data associated with the query is stored in PQRY, an instance of the AQUERY class. For example, PQRY.QWHERE gives the filtering conditions. Using the example URL format above, it would contain an ID between "A" and "F".
  • The other URL parameters can be found through the PARVAL function in ASYRMAIN. For example, DISP=func ASYRMAIN.PARVAL(ARCV,"disp_summary") would fill the DISP variable with a "true" string.

Example

# This piece of code has to be called by Gosub on the AQUERY_DECODE_CRITERIA_AFTER event
# Here, the class managed is an interface class
# So we need to declare a "pseudo table" (that will be filled) with [LNK_] abbreviation.
$AQUERY_OPEN_AFTER
  # Add a condition on ID field
  If PQRY.QWHERE<>"" : PQRY.QWHERE -= 'and' : Endif
  PQRY.QWHERE -= 'ID gt ""'
Local Char ID(20)(1..)
Local Integer INT_VAL(1..)
Local Date DATE_EVENT(1..)
Local Char AMOUNT(1..)
  Gosub FILL_ARRAY : # The array is supposed to be filled here by computed data
                   : # taking into account the PQRY.QWHERE conditions
# A dedicated "Local file" syntax allowing to declare a "pseudo table"
#   that contains the values stored in an array
Local File    (
&               Char    IDKEY(20),
&               Integer INTEG,
&               Date    DAT,
&               Decimal AMOUNT
&             ) From Variable
&   ID,INT_VAL,DATE_EVENT,AMOUNT As [LNK_]
Return