Using the List & Label Formula Parser "Creatively"

Valid from List & Label 6
List & Label can not only be used for printing, but also for performing calculations. The List & Label formula parser can be used to evaluate any expression in its formula language. For example: if you'd like to know the Julian date of a given "normal" date. Many programming environments don't have any API functions for such conversions. With List & Label you can get the required result easily. The key is the usage of the LlExpr...() API.

Let's assume "DateBuffer" would be an initialized buffer, the calls would be easy as (without error checking):
lExpr = LlExprParse(hJob,"DateToJulian(Date('12/24/2009'))", FALSE)
LlExprEvaluate(hJob, lExpr, @DateBuffer, 255)
LlExprFree(hJob, lExpr)


The first call builds up a function tree, containing the required formula (here: DateToJulian(Date(‘12/24/2009’)). The second call causes the List & Label formula parser to evaluate the given formula and return the result in “DateBuffer”. The third call frees the memory used up by the function tree.

In this way, many complicated (or less complicated) tasks can easily be passed on to List & Label’s formula parser.

IDKBTE000464 KBTE000464