I am trying to create a lobby data source using an intersect query.
Effectively the query is pulling from the same view but using different criteria to match the records.
The query works perfectly in SQL developer but I am having issues being able to make it work in the data source.
Alternatively is there a way in a lobby to display quick report results rather than a link to the quick report?
Many Thanks
Best answer by Tracy Norwillo
If I understand you correctly, the following condition should work to get shop orders satisfying both sets of conditions. Of course, putting the intersect in an IAL would work too.
exists (select1from so_oper_dispatch_list a
where so_oper_dispatch_list.order_no = a.order_no
and so_oper_dispatch_list.release_no = a.release_no
and so_oper_dispatch_list.sequence_no = a.sequence_no
and a.operation_no = '1000'and a.oper_status_code = 'Released'and a.work_center_no = 'B0151'and a.state = 'Started'
)
andexists (select1from so_oper_dispatch_list b
where so_oper_dispatch_list.order_no = b.order_no
and so_oper_dispatch_list.release_no = b.release_no
and so_oper_dispatch_list.sequence_no = b.sequence_no
and b.operation_no = '999'and b.oper_status_code = 'Closed'and b.state = 'Started'
)
As far as I can tell, the Condition on a Lobby data source is what would go in a WHERE clause. INTERSECT is not really part of a WHERE clause, so it doesn’t fit there.
Have you thought about creating an IAL then querying that as your data source’s View? You can also employ API method calls in the Condition, but I am not sure that can help you here…
If I understand you correctly, the following condition should work to get shop orders satisfying both sets of conditions. Of course, putting the intersect in an IAL would work too.
exists (select1from so_oper_dispatch_list a
where so_oper_dispatch_list.order_no = a.order_no
and so_oper_dispatch_list.release_no = a.release_no
and so_oper_dispatch_list.sequence_no = a.sequence_no
and a.operation_no = '1000'and a.oper_status_code = 'Released'and a.work_center_no = 'B0151'and a.state = 'Started'
)
andexists (select1from so_oper_dispatch_list b
where so_oper_dispatch_list.order_no = b.order_no
and so_oper_dispatch_list.release_no = b.release_no
and so_oper_dispatch_list.sequence_no = b.sequence_no
and b.operation_no = '999'and b.oper_status_code = 'Closed'and b.state = 'Started'
)
Is there a reason @Tracy Norwillo ‘s solution won’t work? A sub-SELECT in the WHERE condition seems rather elegant. Nothing wrong with an IAL, but I find them a bit tedious to set up and maintain across environments, etc.
Thanks everyone - I wanted to avoid the creating IAL as I am trying to demonstrate shop orders that are sitting between the last closed operation and the next station on the production line. - As our business has multiples lines and stations I don’t feel the IAL is the right way to go.
@Tracy Norwillo - thanks - this doesn’t quite work but I will explore this a bit further.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.