Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
sweens78
Creator
Creator

Using a varible to change name in a list box

Hi Guys,

Apologies I'm new to Qlikview I'm trying to create a variable  to change the names in a list box so the user will understand.

So for example one of the names in the list box is

'3 MH' but I want to change it to 'Mental Health' another is

'1 Acute' just want to call it 'Acute' if that makes sense?

Do I need to create a variable for each one or can I add it into one variable.

Thanks a mill

Martin

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Are the values Mental Health, Acute etc are manually defined or do you have any other field that holds these values? How many values need to be converted? As m w suggested you need to create a mapping table to your original table to get your renamed values. Something like

If values are less you can use an INLINE load of your new names like

MapID:

LOAD * INLINE [

ListboxFieldName, RenamedValue

3 MH, Mental Health

1 Acute, Acute

];

something like above.

If you have a field with the above mapped values from an excel you can do that too.

Like below:

MapID:

MAPPING LOAD ListboxFieldName, RenamedValue

FROM ExcelmappingsourceFile;

OriginalTable:

LOAD *, ApplyMap('MapID', ListboxFieldName) AS NewName

FROM yourSource;

View solution in original post

8 Replies
m_woolf
Master II
Master II

Use a mapping table in script

vishsaggi
Champion III
Champion III

Are the values Mental Health, Acute etc are manually defined or do you have any other field that holds these values? How many values need to be converted? As m w suggested you need to create a mapping table to your original table to get your renamed values. Something like

If values are less you can use an INLINE load of your new names like

MapID:

LOAD * INLINE [

ListboxFieldName, RenamedValue

3 MH, Mental Health

1 Acute, Acute

];

something like above.

If you have a field with the above mapped values from an excel you can do that too.

Like below:

MapID:

MAPPING LOAD ListboxFieldName, RenamedValue

FROM ExcelmappingsourceFile;

OriginalTable:

LOAD *, ApplyMap('MapID', ListboxFieldName) AS NewName

FROM yourSource;

View solution in original post

sweens78
Creator
Creator
Author

20180618_155406.jpg

sweens78
Creator
Creator
Author

HI Vishwarath,

Above is what I mean to change the content within the field named DivLink,

does that make sense?

Martin

vishsaggi
Champion III
Champion III

Ok so what are the corresponding values you want to see for the DivLink field you need to give us all the values to be displayed for DivLink values. You can use Mapping or some Match function for this.

sweens78
Creator
Creator
Author

Hi Vishwarath I haven't them all but for example

1 Acute I want to rename Acute

2 Prim Care to rename Primary Care

2.2 Soc INCL to Social Inclusion

2.3 Pal Care to Pal Care

3 MH to Mental health and so on.

If I do make a mapping table where do I put the code is it just below my main code?

Martin

vishsaggi
Champion III
Champion III

try below: Add any additional Div Link names in the below MapID table with their converted name and use ApplyMap in your source table where you have this Div Link field as shown below. If you did not get what i am saying just share your actual script where you have this issue.

MapID:

MAPPING LOAD * INLINE [

Div Link, NewName

1 Acute,       Acute

2 Prim Care,   Primary Care

2.2 Soc INCL,  Social Inclusion

2.3 Pal Care,  Care

3 MH,          Mental health

];

Source:

LOAD *,

     ApplyMap('MapID', [Div Link]) As NewLinkName

From YoursourceTableName;

sweens78
Creator
Creator
Author

Hi Vishwarath,

Got it working with an earlier code you provided see below, just placed below main code

Thanks a mill,

Your a gentleman

Martin

MapID:

LOAD * INLINE [

Div Link, RenamedValue
1 ACUTE, Acute
7 NAT SERV, Nat Serv
5 H&W, H&W
3 MH, Mental Health
6 NAS, NAS
2 PRIM CARE, Primary Care
2.3 PALL CARE, Pall Care
2.2 SOC INCL, Social Inclusion
4.1 SC DIS, SC Dis
4.2 SC OLD, SC Old


];