Event aquery_trans_after

This event is used for representations, when a query facet is requested, on every line returned to fill a line of the query.

It can be used to assign properties that are not present in the tables or that have a different name so that the Setinstance instruction used to assign the class property will not work.

Available variables

  • this.MYINST is defined and corresponds to the data class representing a line (MYINST being the instance name of the class defined in the representation).
  • The tables present in the query are filled with the values of the current line. It can be the [LNK_] class if the class is an interface class, or the different tables present in the Link instruction.
  • [L]ASTATUS can be set either to [V]CST_AOK if the line must be sent to the query result, or to another value ([V]CST_AERROR for instance) if it must not be sent to the query result. This allows notably to perform additional filtering that is not based on a single filter condition that could have been given on the query request.

Example

# A field has been added in the class to give the length of another column,
# and a ranking based on a computation
# the value that have an amount equal to 0 are discarded
$ TRANSFER_FIELDS
  this.MYT.FLDLEN=len([MYT]COMMENT)
  If [MYT]AMOUNT=0
    [L]ASTATUS=[V]CST_AERROR
  Else
    this.MYT.MARK=string$([MYT]AMOUNT<100,"poor")+string$([MYT]AMOUNT>=100 and [MYT]AMOUNT<1000,"average")
&                +string$([MYT]AMOUNT>=1000 and [MYT]AMOUNT<5000,"good")
&                +string$([MYT]AMOUNT>5000,"outstanding")
  Endif
Return