Using these for generic expressions in the client engine is wonderfully useful. However since they are 'obsolete' a built-in alternative seems obvious to me. My research says there are no alternatives to the functions despite the references to AdsBuildRawKey, AdsInitRawKey which appear to work strictly with indexes.

Please excuse my lack of knowledge on this subject. Is there a built-in solution for doing the equivalent of AdsEvalStringExpr and AdsEvalLogicalExpr using field names for the current record and the various functions used in table filters?


// return true if values are aaa and bbb

AdsEvalLogicalExpr('FIELD1="aaa" and FIELD2="bbb"');

// concatenate these values into a filename


asked 02 May '16, 07:11

pmanderson's gravatar image

accept rate: 0%

edited 02 May '16, 07:11

This family of functions :-
and AdsEvalStringExpr
is still supported through to ADS12. They only work for XBase expressions (not the SQL scalar functions, although there is an overlap). They handle fieldnames surprisingly quickly. To concatenate fieldnames, you have to use the '+' operator, and you have to ensure all fields are "stringified" before applying the '+' operator. Also, adding a string to a character field will keep the trailing spaces on the end of that field. Here are some example AnsiString arguments for the family of functions above, where FIELD1 is a DBF character field of 10 characters, containing the text 'markj' :-

FIELD1+'Howdy' would give 'markj     Howdy'
RTRIM(FIELD1)+' Howdy' would give 'markj Howdy'

If FIELD1 was a date field, you would have to use DTOC(FIELD1) to add it to a string, and if it were a numeric field, you would have to use LTRIM(STR(FIELD1)). N.B. You cannot use a memo field in such constructs - the only way you can use a memo field in an ADS expression is in EMPTY(FIELD1), i.e. with the EMPTY function surrounding it.

So, your first example would work as is, and the single equals sign means return true if the first 3 characters of the field match the test string. Double equals would mean exact match. But your second example needs you to specify how to concatenate the strings, and the expression would have to be :-

The reason that the functions are obsolete, is that, when the result of the evaluation exceeds about 4K in length, the expression engine throws exceptions (error 4404 expression engine stack overflow is one of them). HTH.


answered 17 May '16, 04:01

ADS%20Veteran%20MJ's gravatar image

ADS Veteran MJ
accept rate: 8%

edited 17 May '16, 04:34

Your answer to the original question.
If responding to a request for additional information, please edit the question or use the comment functionality.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 02 May '16, 07:11

Seen: 1,650 times

Last updated: 17 May '16, 04:34

Advantage Developer Zone Contact Us Privacy Policy Copyright Info

Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.