Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Converting Number into Text or String

Hi All,

We have a table with two columns as follows"

Code_1     Code_2     Final_Code

ABC                         ABC

DEF                         DEF

ZYX          098          ZYX

               123

               456

               789

Now the logic is, if we have a value in Code_1 column than the same should be copied in Final_Code, else if the value in Code_1 is NULL than the subsequent value from Code_2 should be copied into Final_Code.

Now the issue we are facing here is that we are unable to convert the Number in Code_2 field into String, hence the value from Code_2 is not getting copied into Final_Code.

Thanks in Advance

2 Replies
Not applicable
Author

Hi

If you're doing this in your data model (loading script)

Sample:

Load

Code_1,

Code_2,

if(len(Code_1) > 0, Code_1, Code_2) as Final_Code

FROM SOURCE;

if your doing it on your straight/Pivot chart then just copy this in your chart

if(len(Code_1) > 0, Code_1, Code_2)

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

You can convert it with using Text() function.

Load

     Text(Code2) AS Code2..

Any other issue on this?