You need to do that where you are forming the query. If you are using JAVA SDK you can form string query by concat based on the conditions and execute query
Yes, currently i am doing the same thing based on the received request i am building individual queries.
Ex If devalue field then building one statement and if both are exist then building another statement, but in this case i might ended up with 6 or 7 queries where so many common query statement is being replicated.
Hence need to build where clause in dynamic way which can only take the fields which is not null
CASE WHEN $val IS NULL THEN true ELSE t.devalue = $val END
You can try single query vs different queries based on your requirement ( single query means each time more predicates needs to evaluate even if not needed, index selection can make complex, which can reflect in performance etc)
I need array list where based on above example only one record should be retrieve, currently throw an exception
SELECT ARRAY token FOR token IN t. ResearchRecords
CASE
WHEN token.cat=“HH” IS NOT NULL
THEN token.category = “HH”
END as SuppAlertList
FROM PREF_INT t
WHERE t. sxonType =" NosAccount "
AND ANY v IN t. ResearchRecords s SATISFIES v.cat=“HH” END
Actual working query
SELECT ARRAY token FOR token IN t. ResearchRecords
WHEN token.cat = “HH” AND token.type=“01” END as SuppAlertList
FROM PREF_INT t
WHERE t. sxonType =" NosAccount "
AND ANY v IN t. ResearchRecords SATISFIES v.cat=“SH” END
ARRAY token FOR token IN t. ResearchRecords
CASE
WHEN token.cat=“HH” IS NOT NULL
THEN token.category = “HH” as notifiSuppAlertList END
FROM PREF_INT t
WHERE t. sxonType =“NosAccount”
AND ANY v IN t. ResearchRecords SATISFIES v.cat=“SH”
END