SYMPTOM
When a particular attribute is used in a report or prompt, the following error is produced in Strategy Developer 9.x and 10.x:
Sample Code/Error
Error: SQLEngine got an Exception from DFC: Engine Logic: Generate SQL for attribute form expression failed, please check if the expression is valid.
Error in Process method of Component: SQLEngineServer, Error Code= -2147212800.
CAUSE
This issue can occur if an attribute form uses a Strategy function that does not have a SQL pattern for the warehouse database type.
Every function defined within Strategy has a list of SQL patterns for each database type that exists in the metadata. Many functions can be written in SQL. For instance, most databases use ABS(x) for absolute value; for these databases, the Abs() function in Strategy would have the SQL pattern ABS(#0). Some functions require different syntax on various database platforms, particularly OLAP functions such as Rank or MovingSum.
If a hypothetical database did not support a certain function, the function's SQL pattern for that database platform would be empty. If the function is used in a metric calculation, the Strategy Analytical Engine takes over the calculation. However, attribute form expressions may be used for grouping aggregate calculations. Thus they must be written into SQL, and functions that will have to be evaluated in the Analytical Engine for that database platform cannot be supported.
ACTION
To resolve the issue, identify the attribute form(s) using Strategy functions. Iterative testing is a valuable diagnostic: remove attributes from the report one by one until the error no longer appears. The last attribute to be removed is probably the cause of the error.
Strategy functions that do not have a built-in SQL pattern for the database platform can be replaced by ApplySimple expressions, provided that some syntax exists for the database.