If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Error Within Expression

Started by parablue, 17 Aug 2022 01:24:03 AM

Previous topic - Next topic

parablue

Hi there.  First time writing here, so apologies if I am in the wrong forum.

Data item 1: I have a data item that looks up the age of an employee and applies a case statement.  The then component is '.1' or '.2' etc depending on the age.  This column is filled with examples like .2 .4 .3 and so on.  I believe these are Varchar.

Data item 2: My other data item is a salary amount divided by 1,000 so the column is filled with $75. $25. etc.

I am trying to multiply both but I get an error stating that multiply is not compatible with double and varchar.

How can I accomplish this? 

Thank you!

MFGF

Quote from: parablue on 17 Aug 2022 01:24:03 AM
Hi there.  First time writing here, so apologies if I am in the wrong forum.

Data item 1: I have a data item that looks up the age of an employee and applies a case statement.  The then component is '.1' or '.2' etc depending on the age.  This column is filled with examples like .2 .4 .3 and so on.  I believe these are Varchar.

Data item 2: My other data item is a salary amount divided by 1,000 so the column is filled with $75. $25. etc.

I am trying to multiply both but I get an error stating that multiply is not compatible with double and varchar.

How can I accomplish this? 

Thank you!

Hi,

You'll need your first data item to return a numeric value rather than a string value. You could do this by changing your case statement to return numeric results, so for example, instead of the THEN component returning '.1' (in single quotes), have it return 0.1 without using quotes.

Alternatively, you could leave your case statement as-is, and have another calculation cast it from a string to a numeric value using a cast() function.

Cheers!

MF.
Meep!