Narrowing the database view with a where clause

miyu
Tera Guru

In the tasks table, I want to display only records whose Task type is Application and Request task (u_application_and_request_task) or Reservation and Result (u_reservation).
I have set the condition in the where clause as follows, but records of other Task types (e.g. incident) are also displayed.

view.png

databaseview.png


How can I fulfill this requirement?
I do not want to use the filter function.

5 REPLIES 5

Aman Kumar S
Kilo Patron

Hi @miyu ,

 

Use of the 'Where clause'

The 'Where clause' in a database view is primarily used to specify join conditions. 

It cannot be used to filter based on field values (ex. 'Active' = 'true').

 

Follow below support article for better understanding:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0719186

 

Best Regards
Aman Kumar

Thank you for your response.
If I want to filter based on field values, do I have to use the filter function?

Hi @miyu ,

 

I see issue with the format of condition you have used. Try the below condition and check if it works:

 

task_sys_class_name == "u_applicatioion_and_request_task"" || task_sys_class_name == "u_reservation"

 

 

I hope this help.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

 

 

Yes

 

Best Regards
Aman Kumar