Hello,
Is there any way to make conditions to generate a query on a Forms Builder Search Template?
ex:
I want to perform the folowing query:
select object_name, number, r_object_type,r_object_id, owner_name, subject, status
from my_custom_folder where number=$number$' AND UPPER(owner_name) like UPPER('$owner$')
AND UPPER(subject) LIKE UPPER('$subject$') AND r_creation_date > date('$data_inicial$','mm/dd/yyyy')
AND r_creation_date < DATEADD(day, 1, date('$data_final$','mm/dd/yyyy') )
AND r_object_id in (SELECT i_folder_id FROM my_custom_document SEARCH DOCUMENT CONTAINS ('$words$') )
but the last AND should only be present if the parameter $words$ were present. If it's empty the last line becomes AND r_object_id in (SELECT i_folder_id FROM my_custom_document) and it's very bad fo the query performance.
Tried to use a join like below, but dql does't alow mix the 'SEARCH DOCUMENTS" in a join with other type
select p.object_name, p.number, p.r_object_type,p.r_object_id, p.owner_name, p.subject, p.estado, p.localizacao_atual, p.r_creation_date,p.especificacao
from my_custom_doc d SEARCH DOCUMENT CONTAINS ('$words$'), my_custom_folder p
where p.number='$number'
AND UPPER(p.owner_name) like UPPER('$owner$')
AND d.i_folder_id=p.r_object_id
AND UPPER(p.assunto) LIKE UPPER('$subject$')
AND p.r_creation_date > date('$data_inicial$','mm/dd/yyyy')
AND p.r_creation_date < DATEADD(day, 1, date('$data_final$','mm/dd/yyyy') )
:[DM_QUERY2_E_JOIN_SEARCH]error: "Your query specifies both a fulltext query and a multi-type join."
What I need to do is seach all custom folders (dm_folder descendents) that has the specified properties AND contais documents that contains the specified words (full-text). But when the user does not specify full text words, the search should ignore the documents inside the folders.
any help would be appreciated