Task:
Via this callback List & Label asks the host to translate a filter expression (as configured in the Designer) to data source native syntax. The callback is triggered multiple times for each part of the filter expression as soon as the application calls to LlPrintDbGetCurrentTableFilter(). This callback can be used e.g. to translate a List & Label filter to an SQL query.
Activate:
Always active, triggered by a call to LlPrintDbGetCurrentTableFilter().
Parameter:
lParam points to a structure scLLEXPR2HOSTEXPR. For readability, the prefix "_p" means that it's a pointer to the argument, but in the description, we call it the argument.
_nSize: Size of the structure
_pszTableID: Table this expression belongs to.
_nType: Type of element that needs to be translated. For most operations, simply set _pvRes to the resulting statement for the operation. If – for example – _nType is LLEXPR2HOSTEXPR_ARG_BINARY_OPERATOR_ADD, the typical return value would be _pvRes = _pv1 + _T("+") + _pv2.
Value |
Meaning |
LLEXPR2HOSTEXPR_ARG_BOOLEAN |
a boolean value |
LLEXPR2HOSTEXPR_ARG_TEXT |
a text value. If you need to parametrize your query to avoid SQL injection attacks, set the _pvName member to a parameter name (on entry, _pvName contains a unique, consecutive integer index that you can use for the name if needed) and set _pvRes to the resulting text. The parameter values will be returned in the corresponding variant passed to LlPrintDbGetCurrentTableFilter(). |
LLEXPR2HOSTEXPR_ARG_NUMBER |
a numeric value. _pvArg1->vt is either VT_I4 for an integer, oder VT_R8 for a floating-point value. |
LLEXPR2HOSTEXPR_ARG_DATE |
a date value |
LLEXPR2HOSTEXPR_ARG_UNARY_OPERATOR_SIGN |
the sign operator |
LLEXPR2HOSTEXPR_ARG_UNARY_OPERATOR_NEGATION |
the negation operator |
LLEXPR2HOSTEXPR_ARG_BINARY_OPERATOR_ADD |
the "+" operator |
LLEXPR2HOSTEXPR_ARG_BINARY_OPERATOR_SUBTRACT |
the "-" operator |
LLEXPR2HOSTEXPR_ARG_BINARY_OPERATOR_MULTIPLY |
the "*" operator |
LLEXPR2HOSTEXPR_ARG_BINARY_OPERATOR_DIVIDE |
the "/" operator |
LLEXPR2HOSTEXPR_ARG_BINARY_OPERATOR_MODULO |
the "%" operator |
LLEXPR2HOSTEXPR_ARG_LOGICAL_OPERATOR_XOR |
the logical xor operator |
LLEXPR2HOSTEXPR_ARG_LOGICAL_OPERATOR _OR |
the logical or operator |
LLEXPR2HOSTEXPR_ARG_LOGICAL_OPERATOR_AND |
the logical and operator |
LLEXPR2HOSTEXPR_ARG_RELATION_EQUAL |
the "=" operator |
LLEXPR2HOSTEXPR_ARG_RELATION_NOTEQUAL |
the "<>" operator |
LLEXPR2HOSTEXPR_ARG_RELATION_LARGERTHAN |
the ">" operator |
LLEXPR2HOSTEXPR_ARG_RELATION_LARGEREQUAL |
the ">=" operator |
LLEXPR2HOSTEXPR_ARG_RELATION_SMALLERTHAN |
the "<" operator |
LLEXPR2HOSTEXPR_ARG_RELATION_SMALLEREQUAL |
the "<=" operator |
LLEXPR2HOSTEXPR_ARG_FUNCTION |
a designer function. _pvName contains the function name, _pv1…_pv4 contain the function's arguments. |
LLEXPR2HOSTEXPR_ARG_FIELD |
a database field. Depending on the target syntax, it might be necessary to escape or frame an identifier name. |
_pvRes: a VARIANT to receive the resulting expression. Set the pointer to NULL or the VARIANT type to VT_EMPTY, if no suitable translation is available. The whole (or in case of an AND operator, the current branch of the) expression is not translated.
_nArgs: Number of arguments. This member is important for functions with optional arguments.
_pvName: Name of function to translate. This member can also be set to handle query parameters (see above).
_pv1: Depending on _nType (see above), the first argument of a function or the left-hand side of an operator.
_pv2: Depending on _nType (see above), the second argument of a function or the right-hand side of an operator.
_pv3: The third argument of a function.
_pv4: The fourth argument of a function.
Return value:
Value |
Meaning |
0 |
Translation was not handled or cannot be handled. The whole (or in case of an AND operator, the current branch of the) expression is not translated. |
1 |
Translation was handled exactly. |
2 |
Translation was handled inexactly; the result will contain more records than appropriate. In this case, List & Label will run its own filtering in addition in order to filter the exceeding records. |