Jump to content
  • 0

Case Statement in Formula of Table


RobDunbar
 Share

Question

Hello All,

 

I am stumped. I have the following case statement in a formula field and it verifys.

CASE
WHEN [@field:SMNType] = 1 THEN 'l1q1.html?XBSPropertyID=' + [@field:SMNPropertyID] + '&;VRRYear' + [@field:SMNYear]
WHEN [@field:SMNType] = 2 THEN 'l1q2.html?XBSPropertyID=' + [@field:SMNPropertyID] + '&;VRRYear' + [@field:SMNYear]
WHEN [@field:SMNType] = 3 THEN 'l1q3.html?XBSPropertyID=' + [@field:SMNPropertyID] + '&;VRRYear' + [@field:SMNYear]
WHEN [@field:SMNType] = 4 THEN 'l1q4.html?XBSPropertyID=' + [@field:SMNPropertyID] + '&;VRRYear' + [@field:SMNYear]
WHEN [@field:SMNType] = 8 THEN 'b1.html'

ELSE ''

END

 

However, when I try to save the table I get Unable to save table due tto incompatible values in one or more formula fields.

image.thumb.png.7f79e426ee304fdbf103826f4f2103db.png

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
14 hours ago, Meekeee said:

Hi @RobDunbar - what are the Data types of [@field:SMNType]  [@field:SMNPropertyID] and [@field:SMNYear]?

Agree with @Meekeee. You need to check what are the Data types of your fields to make sure that it is compatible when you will try to concatenate or add it. If they have different Data types, you can try to convert them all as one Data type.

Link to comment
Share on other sites

  • 0

Hello, @RobDunbar, could you please try this formula if this will work? 

CASE
WHEN [@field:SMNType]= 1 
THEN 'l1q1.html?XBSPropertyID=' + CONVERT(VARCHAR,[@field:SMNPropertyID]) + '&;VRRYear' + CONVERT(VARCHAR,[@field:SMNYear])
WHEN [@field:SMNType]= 2
THEN 'l1q2.html?XBSPropertyID=' + CONVERT(VARCHAR,[@field:SMNPropertyID]) + '&;VRRYear' + CONVERT(VARCHAR,[@field:SMNYear])
WHEN [@field:SMNType]= 3
THEN 'l1q3.html?XBSPropertyID=' + CONVERT(VARCHAR,[@field:SMNPropertyID]) + '&;VRRYear' + CONVERT(VARCHAR,[[@field:SMNYear])
END

Since you your fields are all Integer DataTypes, and you're concatenating it to a String, you need to convert the Integer fields into a String as well. 

I hope this helps! ;)

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

×
×
  • Create New...