Using the Formula Assistant From Your Own Application

Valid from List & Label 13
The following code snippets show how to call the List & Label formula assistant stand alone for usage within your application.

Hint: Please note this functionality is only available in the Enterprise Edition!

.NET


ListLabel LL = new ListLabel();
ExpressionEvaluator eval = new ExpressionEvaluator(LL);
string inputFormula = eval.EditExpression("", "Formula");

try
{
    object evalFormula = eval.Evaluate(inputFormula);
}
catch(ListLabelException exp)
{
    string errorMessage = exp.Message;
} 

C++


BOOL EditWithDialog(const CString& sTitle, CWnd* pParent, CString& rsExpression)
{
    ASSERT(m_hJob != NULL);
    BOOL bRet = TRUE;
    TCHAR* paczBuffer = NEW TCHAR[MAX_RESULTLEN+1]; ASSERT(paczBuffer);
    
    memset(paczBuffer, 0, MAX_RESULTLEN+1);
    _tcsncpy(paczBuffer, rsExpression.c_str(), MAX_RESULTLEN);
    
    bRet = ::LlDlgEditLineEx(m_hJob,
    pParent->GetSafeHwnd(),
    paczBuffer,
    MAX_RESULTLEN,
    0x10000000,
    sTitle.c_str(),
    FALSE,
    NULL) == 0;
    
    if (bRet)
    rsExpression = paczBuffer;
    
    delete[] paczBuffer;
    return(bRet);
} 

VCL


var
eval: TLl21ExprEvaluator;
ll: TL21_;

begin
    ll := TL21_.Create(self);
    eval := TLl21ExprEvaluator.Create(ll, 'Formula', false);
    try
        eval.EditExpression('Title');
        ShowMessage(eval.ErrorText);
    finally
        eval.Free;
        ll.Free;
    end;
end; 


Further information can be found in the programmer’s reference for the “LlDlgEditLineEx” API function.

IDKBTE000718 KBTE000718