Database View Syntax for where clause

dlrich
Kilo Contributor

I want to filter a database view so that the output is only certain values in the view.   For example, on the task table, I want task to be of certain task type or certain states (tsk_sys_class_name = 'sc_request' AND tsk_state = '1')
but nothing I do seems to work.

10 REPLIES 10

jbrooke
Tera Contributor

Hello,



I'm trying to do the same thing. Nothing filters the view to on the records based on the where clause. Did you ever get it to work?



Thanks


Jana


Rodrigo Higa
Kilo Guru

Hi Dave,



I'm facing the same issue here, Have you figured out yours?



Regards,


Rodrigo Higa


Michi466lez
Kilo Contributor

Hello,


I arrived here looking for the same issue. In case that this may help somebody in the future: in my case the problem was the order.


The syntax is as simple as:



(a_tablename = 'incident' && a_fieldname = 'assignment_group')



but I had to increase the order of the 'View Table' from 100 to 900 for this filtering clause to apply correctly and not to show the whole list.


This was due to the fact that the other table used in this View was marked as Left Join, though.



Regards,


Miguel


Mariano Lemus
Kilo Guru

The database view does not know about this condition: tsk_state = '1'




You need to add sys_choice table, place some WHeRE Clause like this > assuming your variable prefix for this table is ch:




(ch_name = 'task' && ch_value = 1 && ch_element = 'state')




Then add your table: task and apply this Where Clause > asusming your variable prefix for this is tsk:




tsk_state = ch_value




This did the trick for a similar problem I had, and I hope it can help.




M