cancel
Showing results for 
Search instead for 
Did you mean: 

Error while validating Calculated Column

Former Member
0 Kudos

Hi Frzz,

I have created a Calculated column of type NVARCHAR by performing some calculation on a filed whose data type is NVARCHAR.

But while validating the view am getting an error " Attribute type is not valid"

Could some one please help me why am getting this error.

Error Details:

Short Text

  Attribute type is not valid

Cause

  Mismatch between data type defined and values computed.

Recommendations

  Check calculated measure/attribute definition and ensure data types match.

Best Regards,

Krishna.

Accepted Solutions (0)

Answers (2)

Answers (2)

kyo_choi2
Participant
0 Kudos

Make sure all the " is correctly used. During copy/paste it can become some other character like shown below.

“SEATSOCC_ALL”/”SEATSMAX_ALL”

rindia
Active Contributor
0 Kudos

Hi Krishna,

Give the same size for example NVARCHAR     20.

Still you face issues then post your screenshot for calculated column and the column in which it based for example table definition for that column.

Regards

Raj

Former Member
0 Kudos

Hi Raj,

I have provided the same size in Calculated column.But still am getting the same error.

1) First i created a calculated column CC_Test1 to perform the TRIM()

2) I created another calculted column CC_test2 on 1st calculated column (CC_Test1)

Table field:

Calculated Column1:

Calculated Column2:

Errror:

rindia
Active Contributor
0 Kudos

Hi Krishna,

The false condition for the last IF is missing I guess something like

(""CC-test1",3,6), 'false'))))))))))

You can replace 'false' with any other depending on your logic.

Regards

Raj

Former Member
0 Kudos

Hi Raj,

I have mentioned 'False condition' as well. But issue didnt solved.

Best Regards,

Krishna.

rindia
Active Contributor
0 Kudos

My suggestion would be first keep only single IF, validate and observe the output, add one more IF validate and observe the output and keep on doing for all the IF's. By this way you have full control of the expression instead of writing all at once and then finding the problem.

Former Member
0 Kudos

Thanks Raj. Will check the same way.

Former Member
0 Kudos

Hi Raj,

I tested with each IF statement.

I found the issue with below IF statement. Is there is any problem with the below statment??/

IF(  (midstr( lpad("CC_test1",8,0) ,1,1) != '0' ) ,"CC_test1",  'E'+midstr ("CC_TEST1",3,6))

Best Regards,

Krishna.

rindia
Active Contributor
0 Kudos

I tried like this and working.

if(midstr(lpad("CC_test1",8),0)  !='0',"CC_test1",'E'+midstr("CC_test1",3))

Former Member
0 Kudos

Hi Raj,

Is the code which you wrote gives the same output which am looking for???

Best Regards,

Krishna.

rindia
Active Contributor
0 Kudos

I just corrected the syntax.

For this i created calculated attribute "CC_test1" based on MATNR column.

former_member184768
Active Contributor
0 Kudos

Just a thought, not tried yet, but can you please provide your 0 in lpad function as '0' like a string, as per the syntax.

string lpad(string, int) 

string lpad(string, int, string)

Regards,

Ravi