Quantcast
Channel: SCN : Popular Discussions - SAP NetWeaver Visual Composer
Viewing all articles
Browse latest Browse all 1353

Problem with SQL Statement for Result Filtering

$
0
0

Dear Visual Composer Experts,

 

Here is another Question from me: I have a SQL Query that is working as the data service

Select AB.AgingBandID, AB.AgingBand,

Sum(Case when priority='Emergency' then '1' Else 0 End) as [Emergency],

Sum(Case when priority='Ugent' then '1' Else 0 End) as Ugent,

Sum(Case when priority='High' then '1' Else 0 End) as High,

Sum(Case when priority='Medium' then '1' Else 0 End) as Medium,

Sum(Case when priority='Low' then '1' Else 0 End) as Low

from DimAgingBand AB left outer join

(Select AgingBandID , priority , yeardesc

from vNotifications where YearDesc = (select year(getdate())-1)) as vN

on AB.AgingBandID=vN.AgingBandID

where AB.AgingBandID<>'1'  

Group by  AB.AgingBandID, AB.AgingBand

Order by AB.AgingBandID

 

That would return me a table as in the following:

     Agingband     E     U     H     M     L

     < 1week     0     0     0     0     1

     1 - 2 weeks     0     0     0     0     0

     2 - 4weeks     0     0     0     0     1

> 1month     8     2     1     1     6

 

Now that I would like to add some parameters to filter the result, so I modify the query and put it in the SQL Statement input port of the same data service. The query is like this:

     "Select AB.AgingBandID, AB.AgingBand,Sum(Case when priority='Emergency' then '1' Else 0 End) as [Emergency],Sum(Case when priority='Ugent' then '1' Else 0 End) as Ugent,Sum(Case when priority='High' then '1' Else 0 End) as High,Sum(Case when priority='Medium' then '1' Else 0 End) as Medium,Sum(Case when priority='Low' then '1' Else 0 End) as Low from DimAgingBand AB left outer join (Select AgingBandID , priority , yeardesc from vNotifications where YearDesc like '2009%' and Branch like '" & if(STORE@selectedBranch=='ALL', '%', STORE@selectedBranch) & "' and MainWorkCentre like '%') as vN on AB.AgingBandID=vN.AgingBandID where AB.AgingBandID<>'1' Group by AB.AgingBandID, AB.AgingBand Order by AB.AgingBandID"

 

However this input port query keeps giving me error as NullPointerException. I have actually specified a condition where the query will run if only STORE@selectedBranch != u2018u2019.

 

I have other filtering queries working but they are not as complicated query as this one. Could it be possible that query in the input port cannot handle left outer join?

 

Could it be anything else?

 

Help is very much appreciated.

 

Thanks & Regard,

Sarah


Viewing all articles
Browse latest Browse all 1353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>