Case Statement help

I have a case statement all ready in my BAQ and works fine. I need add something else but get a syntax error.
This is the original Case statement:
image

I thought I could do this…But what do I know…I am weak in this area…highlighted yellow is what I added.
image

I don’t really like nested case statements (if not required), and it looks like in this case you can simply assess each condition (assuming your conditions are mutually exclusive). This would help clean up the syntax confusion. I think you could do this:

case
	when condition1 = 1 then 'result1'
	when condition2 = 2 then 'result2'
	when condition10 = 10 then 'result10'
end

This allows you to maintain your conditions and results list easily without worrying about nesting it even further. Do be aware it will assess the conditions in the order received.

2 Likes

try this…

(case when DMRHead.CheckOff3 = 1 then 'Prod' 
else (case when DMRHead.CheckOff4 = 1 then 'PUR' 
else (case when DMRHead.OutProcess_c = 1 then 'Outside' 
else '' end ) end) end)
2 Likes

THanks this one worked best for my situation.

I found my error…Works perfect