# Getting values from NULLs

**URL:** <https://forum.inductiveautomation.com/t/getting-values-from-nulls/62970>\
**Category:** Ignition\
**Tags:** database, ignition81, perspective\
**Created:** [August 12, 2022, 8:00pm UTC](https://forum.inductiveautomation.com/t/getting-values-from-nulls/62970 "2022-08-12T20:00:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 12, 2022, 8:00pm UTC](https://forum.inductiveautomation.com/t/getting-values-from-nulls/62970/1 "2022-08-12T20:00:57Z")

</div>

I have this Query:

```auto
SELECT
	COUNT(x.dwActualNumberOfDoffings) AS 'DoffCount'    
	,x.sRecipeName AS 'Denier'    
	,SUM(Shift_Weight) AS 'Shift_LBS'
	,SUM(Shift_Length) AS 'Shift_Meters'
FROM
(           
SELECT                
dwActualNumberOfDoffings                
,sRecipeName               
,CASE                
WHEN sRecipeName = '1385 denier' THEN (42000)               
WHEN sRecipeName = '1411 Denier' THEN (31500)               
WHEN sRecipeName = '1426 Denier' THEN (38000)               
WHEN sRecipeName = '1700 Denier' THEN (26000)               
ELSE NULL          
END 'Shift_Length'
,CASE                
WHEN sRecipeName = '1385 denier' THEN (14.2)               
WHEN sRecipeName = '1411 Denier' THEN (10.9)               
WHEN sRecipeName = '1426 Denier' THEN (13.9)               
WHEN sRecipeName = '1700 Denier' THEN (10.8)               
ELSE NULL               
END 'Shift_Weight'           
FROM BitWinder_1_LH           
WHERE dwActualNumberOfDoffings >= 1           
AND t_stamp BETWEEN '2022-07-01 08:00:00' AND '2022-07-31 20:00:00'
) AS x
GROUP BY x.sRecipeName

```

And it returns this:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/7/47075ac960e21ab4fe046e33d60fb7731e870711.png)

I am trying to have the Columns that have NULL return a value based off a calculation, something like this: (if denier = 1411 then doffcount \* 10.8 = shift\_lbs) Im just not sure how to input it into the query.

Any help would be great.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 12, 2022, 8:48pm UTC](https://forum.inductiveautomation.com/t/getting-values-from-nulls/62970/2 "2022-08-12T20:48:42Z")

</div>

Would it be better to fix why you’re getting nulls in the fist place? The leading whitespace in the Denier column’s last two rows gives it away. Unless there is a reason for it.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 12, 2022, 9:05pm UTC](https://forum.inductiveautomation.com/t/getting-values-from-nulls/62970/3 "2022-08-12T21:05:40Z")

</div>

Yep that would be better, I didnt notice that white space. That much better. I can fix that easy. Thanks alot for the different set of eyes.
