Jump to content
  • 0

SQL syntax problem


SteveMott

Question

5 answers to this question

Recommended Posts

  • 0

Hello @SteveMott,

I don`t see the PRR field on the screenshots that your provided. I assume that this is some numeric field in the FullReactionIngredients table.

If so, it looks like the syntax for converting the value is not correct.

Please test this instead:

CASE 

WHEN (SELECT COUNT(DrugReactionID) FROM FullReactionIngredients WHERE DrugReactionID = '[@calcfield:1]') = 1

THEN (SELECT CONVERT(VARCHAR, PRR) FROM FullReactionIngredients WHERE DrugReactionID = '[@calcfield:1]')

ELSE 'No cases reported'

END

 

I think for the similar requests you may contact support team via tickets to get a quicker reply.

Link to comment
Share on other sites

  • 0

Thanks @CoopperBackpack

The calculation still goes to ELSE even when the conditions for the WHEN statement are true.

I have the WHEN statement working correctly in other tables, so I am wondering what the preconditions for this to succeed need to be met.

I shall take your advice and put in a ticket to support.

I do appreciate your time.

Thanks

Steve

Link to comment
Share on other sites

  • 0

Hi @CoopperBackpack

 

Support got back to me with this code:

CASE

WHEN (SELECT COUNT(DrugReactionID) FROM FullReactionIngredients WHERE DrugReactionID = (target.[@field:IngredientID]+'[@ReactionID]')) = 1

THEN (SELECT CONVERT(VARCHAR, (PRR)) FROM FullReactionIngredients WHERE DrugReactionID = (target.[@field:IngredientID]+'[@ReactionID]'))

ELSE 'No cases reported'

END

 

Thanks and Cheers

Steve

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...