AnsweredAssumed Answered

ExcecuteSQL when result is NULL?

Question asked by weedonpaul on Nov 22, 2015
Latest reply on Nov 23, 2015 by okramis

To Start off I am new to the world of ExecuteSQL. I have had a lot of help from this community to the point where I have created a script that works.

 

I did raise this question at the end of another thread but it was getting 3 pages long and I figured It's a different question than the original.

 

The script below is for one of the Y values series (4 in all) where I want a graph to show the breakdown of coverage for a given month. The problem is that when it gets a null result. The script below, when run over the last 3 months will only return 2 results as one month had no "feature" coverage. I would like it to put a zero in when the result is NULL

 

Some thing along the lines of CASE WHERE \"_kf_clients_id\"= ? AND publication_date >= ? AND publication_date <= ? AND type = ? IS NULL THEN "0"

 

Obviously as I understand nothing about this and so putting this in didn't work, Can anyone Help?

 

Currently the result is

2

4

 

But I would Like

2

0

4

 

ExecuteSQL (

 

"SELECT COUNT(publication_month_number)

FROM coverage_For_Report

WHERE \"_kf_clients_id\"= ? AND publication_date >= ? AND publication_date <= ? AND type = ?

GROUP BY publication_month_number "

;"";"";Coverage_Report::_kf_clients_id; Coverage_Report::start_date; Coverage_Report::end_date; "Feature")

Outcomes