Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
helen_pip
Creator III
Creator III

Apostrophe in an If statement

    Hello

I have an IF statement where I need to incorporate an apostrophe

How would I possibly reqrite the If statement to get around the fact that I ahve an apostrophe, beacuse as the moment I am getting an error message if I run the script

If Statement

 

If(Breach_Location = 'Paed's Waiting' Or Breach_Location = 'Paeds Wait1' or Breach_Location

= 'Paeds Wait2', 'Paediatrics Waiting',

This is only part of a larger IF statement

Error Message:

Error in expression:

')' expected

Thanks

Helen

1 Solution

Accepted Solutions
SunilChauhan
Champion II
Champion II

If(Breach_Location = 'Paed' &chr(39)&'s Waiting' Or Breach_Location = 'Paeds Wait1' or Breach_Location

= 'Paeds Wait2', 'Paediatrics Waiting',' Some Text')

use above .

hope this helps

Sunil Chauhan

View solution in original post

11 Replies
Sokkorn
Master
Master

Hi Helen,

Let do this

If(

    Breach_Location = 'Paed's Waiting' Or

    Breach_Location = 'Paeds Wait1' or

    Breach_Location = 'Paeds Wait2',

'Paediatrics Waiting', 'Others'

)

Regards,

Sokkorn

SunilChauhan
Champion II
Champion II

If(Breach_Location = 'Paed' &chr(39)&'s Waiting' Or Breach_Location = 'Paeds Wait1' or Breach_Location

= 'Paeds Wait2', 'Paediatrics Waiting',' Some Text')

use above .

hope this helps

Sunil Chauhan
Sokkorn
Master
Master

Or you can use Match function

IF(Match(Breach_Location, 'Paed's Waiting', 'Paeds Wait1', 'Paeds Wait2'),'Paediatrics Waiting','Other')

Regards,

Sokkorn

helen_pip
Creator III
Creator III
Author

Thanks for your response

I have tried both of you who ahve kindly replied techniques, but I still get an error message

Perhaps if I teel you the entire IF statement, you will be kind enough to help me rewrite it

 

If(Breach_Location = 'Paeds Bay 1' or Breach_Location = 'Paeds Bay 2' or Breach_Location = 'Paeds Bay 3'
or Breach_Location = 'Paeds Bay 4' or Breach_Location = 'Paeds Bay 5' or Breach_Location = 'Paeds Side Room', 'Paediatrics',
If(Breach_Location = 'Paed's Waiting' Or Breach_Location = 'Paeds Wait1' or Breach_Location = 'Paeds Wait2', 'Paediatrics Waiting',
If(Breach_Location = 'Resus 1' or Breach_Location = 'Resus 2'or Breach_Location = 'Resus 3' or Breach_Location = 'Resus 4' or Breach_Location = 'Resus 5'
or Breach_Location

= 'Resus 6', 'Resus',

)))) as Test

The highlighted part is causing me problems

Any help would be greatly appreciated

Not applicable

Hi

You could also try

if(Replace(Breach_Location

,chr(39),' ')='Paed s Waiting'

Or Breach_Location = 'Paeds Wait1' or Breach_Location

= 'Paeds Wait2', 'Paediatrics Waiting',' Some Text')


Kind Regards,

Footsie

peter_turner
Partner - Specialist
Partner - Specialist

Hello Helen,

You can use the command chr(39), as per luminary's example

This will tell QlikView to insert the ascii letter for code 39, with is the ' symbol, useful when you need to include symbols that QlikView uses as part of the expressions.

http://www.asciitable.com/

Sounds like an interesting app if it’s counting breach time and amounts etc.

Sokkorn
Master
Master

Hi Helen,

Maybe this one can help

If(

    Match([Breach_Location],'Paeds Bay 1','Paeds Bay 2','Paeds Bay 3','Paeds Bay 4','Paeds Bay 5','Paeds Side Room'), 'Paediatrics',

If(

    Match([Breach_Location],'Paed' & Chr(39) & 's Waiting','Paeds Wait1','Paeds Wait2'), 'Paediatrics Waiting',

If(

    Match([Breach_Location],'Resus 1','Resus 2','Resus 3','Resus 4','Resus 5','Resus 6'), 'Resus'

))) as Test

Regards,

Sokkorn

SunilChauhan
Champion II
Champion II

have tried Chr(39) as i suggested above

If(Breach_Location = 'Paeds Bay 1' or Breach_Location = 'Paeds Bay 2' or Breach_Location = 'Paeds Bay 3'
or Breach_Location = 'Paeds Bay 4' or Breach_Location = 'Paeds Bay 5' or Breach_Location = 'Paeds Side Room', 'Paediatrics',
If(Breach_Location='Paed' &chr(39)&'s Waiting' Or Breach_Location = 'Paeds Wait1' or Breach_Location = 'Paeds Wait2', 'Paediatrics Waiting',
If(Breach_Location = 'Resus 1' or Breach_Location = 'Resus 2'or Breach_Location = 'Resus 3' orBreach_Location = 'Resus 4' or Breach_Location = 'Resus 5'
or Breach_Location

= 'Resus 6', 'Resus',

)))) as Test

hope this helps

Sunil Chauhan
Not applicable

Hi helen_pip,

Please try this.It will solve your problem.

If(Breach_Location = 'Paed'&chr(39)&'s Waiting' Or Breach_Location = 'Paeds Wait1' or Breach_Location

= 'Paeds Wait2', 'Paediatrics Waiting',

Let me know.