Dynamic Query Statement

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Angarato
Posts: 29
Joined: Thu Feb 08, 2007 1:06 am

Dynamic Query Statement

Post by Angarato »

Hello!

My situation is as follows:

1. I have non-persistent object with four attributes in order to search for
some persisten object.
2. At the time of creation of non-persistent object there is a rule that
checks whether at least one parameter out of four is defined. If nothing is
defined the system generates the error message.
3. However, if user defines only three out of four parameters and leaves
the fourth blank, I have to dynamically generate the corresponding query
statement to instruct system to search only for parameters entered and
don't even look at the fourth parameter that is left undefined.
4.Thesame logic needs to be applied for any numbers of parameters
defined (2, 3 or 4).

Does anybody have the similar situation and if yes could you please
provide me the idea of the implementation of this mechanizm.

Thank you! Any help is really appreciated!

Angarato.
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Hi Angarato,

Your query could look like this:

FIND MyObject WHERE (MyObject.Attr1 CONTAINS SearchParams.Param1 OR SearchParams.Param1 IS UNDEFINED) AND (MyObject.Attr2 CONTAINS SearchParams.Param2 OR SearchParams.Param2 IS UNDEFINED) AND ...

Any of the Param attributes in SearchParams object left blank by the user will be effectively excluded from the filtering.
Aware IM Support Team
Post Reply