Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

associate a string to a number

Hi everyone,

I get data in form of numbers.I have to assign a string to it.

Thanks,

Asmita

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Your requirement is still somwhat unclear, an example always helps to understand.

You can look into conditional functions to assign strings to your numbers when loading in, or look into a Mapping approach:

1)

LOAD Number,

          if(Number = 1, 'One',

               if(Number = 10, 'Ten',

                    if(Number = 100, 'Hundred')

                 )

          )                                         as NumberText

FROM ....;

2)

NumberMap:

MAPPING LOAD * INLINE [

F1, F2

1, One

10, Ten

100, Hundred

];

LOAD Number,

          applymap('NumberMap', Number) as NumberText

FROM ...;

View solution in original post

3 Replies
Not applicable
Author

hi

try text(fieldname)  function

swuehl
MVP
MVP

Your requirement is still somwhat unclear, an example always helps to understand.

You can look into conditional functions to assign strings to your numbers when loading in, or look into a Mapping approach:

1)

LOAD Number,

          if(Number = 1, 'One',

               if(Number = 10, 'Ten',

                    if(Number = 100, 'Hundred')

                 )

          )                                         as NumberText

FROM ....;

2)

NumberMap:

MAPPING LOAD * INLINE [

F1, F2

1, One

10, Ten

100, Hundred

];

LOAD Number,

          applymap('NumberMap', Number) as NumberText

FROM ...;

Not applicable
Author

Thanks,

The if loop worked