Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Re: How do I show a number as a Text counterpart ?

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

Regards,
Prashant Sangle
5 Replies

Re: How do I show a number as a Text counterpart ?

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

Regards,
Prashant Sangle
MVP
MVP

Re: How do I show a number as a Text counterpart ?

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

Re: How do I show a number as a Text counterpart ?

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

MVP
MVP

Re: How do I show a number as a Text counterpart ?

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

Re: How do I show a number as a Text counterpart ?

this is much easier , thanks jagan mohan

Community Browser