Jump to content
  • 0

CASE statement returns a blank value no matter what


NickO

Question

I have a datapage which make about 14 different calculations to get to a list of calculated fields. I am trying to take any row in which there is a "2" and display "Primary" in this row. Each of the calc fields contains the value of blank (perhaps NULL? it is a query that is returning no results), 0, 1 or 2. Below is my case statement that is not playing nice. I appreciate any input.

 

CASE
WHEN [@calcfield:3] = 2 THEN 'PRIMARY'
WHEN [@calcfield:4] = 2 THEN 'PRIMARY'
WHEN [@calcfield:5] = 2 THEN 'PRIMARY'
WHEN [@calcfield:6] = 2 THEN 'PRIMARY'
WHEN [@calcfield:7] = 2 THEN 'PRIMARY'
WHEN [@calcfield:8] = 2 THEN 'PRIMARY'
WHEN [@calcfield:9] = 2 THEN 'PRIMARY'
WHEN [@calcfield:10] = 2 THEN 'PRIMARY'
WHEN [@calcfield:11] = 2 THEN 'PRIMARY'
WHEN [@calcfield:12] = 2 THEN 'PRIMARY'
WHEN [@calcfield:13] = 2 THEN 'PRIMARY'
WHEN [@calcfield:14] = 2 THEN 'PRIMARY'
WHEN [@calcfield:15] = 2 THEN 'PRIMARY'
WHEN [@calcfield:16] = 2 THEN 'PRIMARY'
WHEN [@calcfield:17] = 2 THEN 'PRIMARY'
ELSE 'NOT'
END

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @NickO,

I think you need to simply combine the condition for assigning 'Primary' value with OR logic operator.

Perhaps you should try the following expression:

CASE
WHEN 	

		[@calcfield:3] = 2 OR 
		[@calcfield:4] = 2 OR
		[@calcfield:5] = 2 OR
		[@calcfield:6] = 2 OR
		[@calcfield:7] = 2 OR
		[@calcfield:8] = 2 OR
		[@calcfield:9] = 2 OR
		[@calcfield:10] = 2 OR
		[@calcfield:11] = 2 OR
		[@calcfield:12] = 2 OR
  		[@calcfield:13] = 2 OR
		[@calcfield:14] = 2 OR
		[@calcfield:15] = 2 OR
		[@calcfield:16] = 2 OR
 		[@calcfield:17] = 2 THEN 'PRIMARY'
        
ELSE 'NOT'
END

Hope this helps.

Regards,

vitalikssssss

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...