Query in Report

devservicenow k
Tera Contributor

i have created a Database View for t
for time card and time worked.
for task and case. it is working .

 

0702c.jpg

 

what changes do i need to do for this?

 

 

1 ACCEPTED SOLUTION

You can always manually filter the List view or Report where the Parent -> State is not one of Closed, Resolved, Cancelled.  To have the Database View ALWAYS exclude these, just create a Business Rule that looks like this:

BradBowman_0-1675793746134.png

Where Table = u_test1 in your case.  The Script on the Advanced tab looks like this:

(function executeRule(current, previous /*null when async*/) {
	current.addEncodedQuery('tt_parent.stateNOT IN3,6,7');
})(current, previous);

 

View solution in original post

5 REPLIES 5

The Database View Where clause is limited in its functionality.  In this case you would need to access a field (state) on a referenced field (parent).  Such dot-walking is not possible in a Database View Where clause, so that's why a Business Rule is needed.