Database View Where Clause Confusion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2013 11:49 AM
Hello,
I'm trying to setup a very basic database view of the Service Catalog table (sc_cat_item). However, I'd like the view to contain only active items. When I try to setup the view, add the view table and setup a Where clause (cat_active = true), the resulting view returns all records in the table. Why is this? This seems like a simple enough "filter" clause....
Thanks,
Brandon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2014 09:18 AM
Hi Brandon,
It sounds disappointing....
So I had done some workaround regarding it.
Thanks a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2014 05:40 AM
Hello Rodrigo,
I am also facing the same issue with where clause operators are not working. what is the workaround you did to make this working. Meanwhile, going to open a hi ticket with SN.
Thanks
Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2014 06:23 AM
One option is to create a "Before Query" Business Rule on the database view.
It would look something like this:
Table: Your Database View Name
When: before
Query: checked
Script:
current.addQuery("field", "value");
current.addQuery("field2", "value2"); // repeat for as many conditions as you wish to add
...etc.
This will add whatever queries you specify as the effective "WHERE" clause.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2014 06:27 AM
Thanks Josh. I like this workaround.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2014 06:25 AM
Hi Kumar,
My workaround was not better then Josh ´s one. I had created two different views joining with the sys_class_name field, which were working for my case. But this idea from Josh is better and more flexible to do whatever you want as a filter.
Thanks Josh;Josh Nerius!