Adding SQL Criteria based on expression
Is it possible to add a SearchCriteria via SQLBuilder based on a calculated
field that is an expression?
e.g.
I want to filter a report where the value of my stock is greater than a
particular amount.
The sql would look like:
SELECT ProductCode FROM Product
WHERE (CurrentStock * AverageCost) > 100
TIA,
Simon
field that is an expression?
e.g.
I want to filter a report where the value of my stock is greater than a
particular amount.
The sql would look like:
SELECT ProductCode FROM Product
WHERE (CurrentStock * AverageCost) > 100
TIA,
Simon
This discussion has been closed.
Comments
The SQLBuilder object does not support adding calculations directly into the
where clause, however you could create a calculated field and filter your
data based on that field. See the TdaSQLBuilder.CalcFields topic in the
ReportBuilder help file for more information.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I can create the calcfield in code and that appears in the sql just fine,
but how do i apply a filter? It works fine the report designer as the
autosearch criteria is replaced by the expression in the sql when I select
the calculated field. How can I achieve this in code? When I try to add the
expression as a searchcritera it seems that because the expression is not
seen as an available field then it is discarded.
Best regards,
Simon
Try creating the calc field in your SQL code before running your
application, giving it a proper alias. Then try adding that calculated
field to your search criteria using the SQLBuilder.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com