Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Using Command Sum Post Reply Post New Topic
Author Message
looeej
Newbie
Newbie
Avatar

Joined: 25 Jun 2015
Location: United States
Online Status: Offline
Posts: 8
Quote looeej Replybullet Topic: Using Command Sum
    Posted: 29 Apr 2016 at 2:26pm
I'm trying to create a report to display status of work orders. I'm utilizing multiple tables to accomplish this. The INNER JOIN has been most useful for sure! Now where I'm hitting a road block in material inventory. Having the same material designation with multiple heat lots created issues for this report. The sum of the material proved to be difficult in crystal 2011. So I found the SUM command (SQL). This works a real treat actually:

Sum(Material_Location.On_Hand_Qty) AS Inv

My issue though is when I have no material (NULL) the row doesn't display at all. I've tried countless ideas via the web but just can't get the blank null values to display!?

This last Command line works great if there is inventory of material:

SELECT Sum(Material_Location.On_Hand_Qty) AS Inv
FROM Material_Req INNER JOIN Material_Location ON Material_Req.Material=Material_Location.Material
GROUP BY Material_Req.Material

Is this a bigger issue than I realize trying to integrate Command and Table Data?




LooeeJ
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 02 May 2016 at 5:13am
You could put in a case statement into your SQL query.

SELECT
CASE WHEN Sum(Material_Location.On_Hand_Qty) IS NULL THEN 0 ELSE Sum(Material_Location.On_Hand_Qty) END AS Inv
FROM Material_Req INNER JOIN Material_Location ON Material_Req.Material=Material_Location.Material
GROUP BY Material_Req.Material
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.