Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I convert a numeric variable to a string?

Hello!

I am trying to convert the values of a particular variable to a string.

I have a variable that looks like this:

Location

101

102

103

...etc.

but I want it to look like this:

Location

'Hawaii'

'New York'

'Chicago'

...etc.

The problem I am running into is that my variable has over 100 different options, so I am finding that QlikView will not allow me to create a calculated dimension like:

=IF(Location=101,Hawaii'

    IF(Location=102,'New York')) etc. for more than 99 locations. It gives me an error message if I go past 99 "if" statements.

Is there a different way to do what I want? Do I need to edit the variable values in the script, and if so, how would I do that?

Thanks!!

3 Replies
swuehl
MVP
MVP

You can use a table to map your values:

Mapping … and not the geographical kind

vishsaggi
Champion III
Champion III

Are you talking about field Location. ?

You can use a mapping table from excel sheet.

Can you tell us from where are you getting this Location information from i mean the ID's and the LocationNames? Is it coming from an excel sheet, if Yes, you can use Mapping functions.

MAPTABLE:

MAPPING LOAD LocID, LOCATION

FROM yourexcelfilename.xlsx.

ACTUALTAB:

LOAD col1, col2, Applymap('MAPTABLE', LocID) AS Location

FROM yourdatasource;

sinanozdemir
Specialist III
Specialist III

Hi,

You can try to implement mapping table

https://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/ScriptPrefixes/Mapping...

Don't join - use Applymap instead

I am attaching an example as well.

Capture.PNG

Hope this helps.