Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rookie_123
Contributor II
Contributor II

Escaping apostrophe in if statement

I have declared a variable vYear_Quarter as follows

    =if(vSelectionValue = 2017,'2017/Q1, 2017/Q2, 2017/Q3, 2017/Q4',

        if(vSelectionValue = 2018,'2018/Q1,2018/Q2'))



The above expression returns vYear_Quarter = 2017/Q1, 2017/Q2, 2017/Q3, 2017/Q4 if I select year 2017 and

vYear_Quarter = 2018/Q1,2018/Q2 if I select year 2018

.But I want to get the value vYear_Quarter in a such a way that it could be fed to a set expression

    =sum({<"YearQ"={'$(vYear_Quarter )'}}>}AMOUNT)


But with the if statement i am not able to get the value of vYear_Quarter  in the form such as '2018/Q1','2018/Q2'


I want 2018/Q1 and 2018/Q2 in apostrophe and seperated by comma

1 Solution

Accepted Solutions
sunny_talwar

Try this may be

=If(vSelectionValue = 2017, Chr(39) & '2017/Q1' & Chr(39) & ',' & Chr(39) & '2017/Q2' & Chr(39) & ',' & Chr(39) & '2017/Q3' & Chr(39) & ',' & Chr(39) & '2017/Q4' & Chr(39),

If(vSelectionValue = 2018, Chr(39) & '2018/Q1' & Chr(39) & ',' & Chr(39) & '2018/Q2' & Chr(39)))

View solution in original post

2 Replies
sunny_talwar

Try this may be

=If(vSelectionValue = 2017, Chr(39) & '2017/Q1' & Chr(39) & ',' & Chr(39) & '2017/Q2' & Chr(39) & ',' & Chr(39) & '2017/Q3' & Chr(39) & ',' & Chr(39) & '2017/Q4' & Chr(39),

If(vSelectionValue = 2018, Chr(39) & '2018/Q1' & Chr(39) & ',' & Chr(39) & '2018/Q2' & Chr(39)))

rookie_123
Contributor II
Contributor II
Author

Amazing