Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
danielle_v
Creator
Creator

Alias Value containing Apostrophe

Hi All,

In my script, I'm trying to alias the values within a field, as follows;

if(Equipment = '40DR', '2T', if(Equipment = '20DR', '1T' ......etc........)) as NewField

This is all fine, however one of the values I need to rename is 45'HC.  The apostrophe in the middle of the value seems to be creating a problem - when I run the script, it thinks that '45' is the value, and so errors.

Is there any way round this? I've tried surrounding the 45'HC in square brackets but this doesn't work either.

Any help much appreciated!!

1 Solution

Accepted Solutions
cesaraccardi
Specialist
Specialist

Hi Danielle,

Try this way: '45' & chr(39) & 'HC'

Regards,

Cesar

View solution in original post

3 Replies
sparur
Specialist II
Specialist II

Hi Danielle

in you case I usually use Map and ApplyMap function. try to create a map table like this:

MAP_Equipment:

mapping

LOAD * Inline[

OldName, NewName

40DR, 2T

20DR, 1T

"45'HC", YourValue

];

and than use this map like this:

LOAD *,

ApplyMap('MAP_Equipment', Equipment, 'N/A') as NewField

FROM...

cesaraccardi
Specialist
Specialist

Hi Danielle,

Try this way: '45' & chr(39) & 'HC'

Regards,

Cesar

danielle_v
Creator
Creator
Author

So sorry for the delay in marking the correct answer - many thanks, worked perfectly!