Dynamic SQL

Hi,

I need to create a dynamic SQL based on options selected by user. defining SQL by text I simply add the param to the sq text based on the user selection. for example:
if param1 <> '' then
SQLText := SQLText + Param1;
if param2 <> '' then
SQLText := SQLText + Param2;
....
How can i do this with Aurelius. I think this can de done using TCriteria.

Any hints.

Thanks in advance,

Omar Zelaya
Hi,

Done.

Thanks

Were you able to do it? Would you mind share the solution for other users?

Hi,
I think i didnt maked my self clear with the question, beause the solution is simple and straightforward actually the sample code should have looked like this:
if AIncidencia = 'S' then
  TxtQry.Add('INFORMES.NOVEDAD = 1 AND ')
else if AIncidencia = 'N' then
   TxtQry.Add('INFORMES.NOVEDAD = 0 AND ');

And I have dobe it like this:
Criteria := Manager.Find<TINFORME>;
if AIncidencia = 'S' then
   Criteria.Add(TExpression.Eq('NOVEDED', 1))
 else if AIncidencia = 'N' then
  Criteria.Add(TExpression.Eq('NOVEDED', 0));

I was used to use Find on the same statement for example
Informes := Manager.Find<TINFORME>
                                  .Add(TExpression.Ge('FECHAA', AFechaI))
                                  .Add(TExpression.Le('FECHAA', AFechaF))
                                  .AddOrder(TOrder.Desc('ID'))
                                  .SubCriteria('ID_SEC_AGENTE')
                                   .SubCriteria('ID_SECCION')
                                    .SubCriteria('ID_OFICINA')
                                    .Add(TExpression.Eq('ID', AIdFiltro))
                                  .List<TINFORME>;

Thanks in advance

Omar Zelaya