Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I show a number as a Text counterpart ?


Hello ,

I have a simple list box and added one field from a SQL database. On display, the box shows 3 rows ;

1

3

20

I would like to display BIRD instead of 1, CAT instead of  3 and DOG instead of 20 . Maybe I can use an expression ? Like match('1' , Fieldname, 'BIRD') or something ?

1 Solution

Accepted Solutions
PrashantSangle

Hi,

Create Inline table

Write in script

* INLINE [
    num, Value
    1, Bird
    3, Cat
    20, Dog
]
;

Then use Value as List box

Or you can handle it on front end

create list box with expression

Like

if(wildmatch(num,'1'),Bird,if(wildmatch(num,'3'),'Cat',if(wildmatch(num,'20'),'Dog')))

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

5 Replies
PrashantSangle

Hi,

Create Inline table

Write in script

* INLINE [
    num, Value
    1, Bird
    3, Cat
    20, Dog
]
;

Then use Value as List box

Or you can handle it on front end

create list box with expression

Like

if(wildmatch(num,'1'),Bird,if(wildmatch(num,'3'),'Cat',if(wildmatch(num,'20'),'Dog')))

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this in script

LOAD

* ,

Pick(Match(num, 1, 2, 20), 'Bird', 'Cat', 'Dog') AS NewField

INLINE [
    num
    1
    3
    20
]
;


Hope this helps you.


Regards,

Jagan.

Not applicable
Author

This was what I needed and it works :

if(wildmatch(num,'1'),'Bird',if(wildmatch(num,'3'),'Cat',if(wildmatch(num,'20'),'Dog')))

Many thanks @max dreamer

jagan
Luminary Alumni
Luminary Alumni

Hi,

Why using 3 ifs and 3 WildMatch(), simply use one WildMatch() and one Pick(), what if you have 50 number?  will you include 50 If() and 50 WildMatch()?

=Pick(WildMatch(num, 1, 3, 20), 'Bird', 'Cat', 'Dog')


Hope this helps you.


Regards,

Jagan.

Not applicable
Author

this is much easier , thanks jagan mohan