Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I fix a Variable when I need it to start with ' and end with '

Hi,

I have the following that I need to use as a variable (shortened):


if(vMaxMonthYear='Jan16','("Jan16")',
if(vMaxMonthYear='Feb16','("Jan16"|"Feb16")',
if(vMaxMonthYear='Mar16','("Jan16"|"Feb16"|"Mar16")',
if(vMaxMonthYear='Apr16','("Jan16"|"Feb16"|"Mar16"|"Apr16")',
if(vMaxMonthYear='May16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16")',
if(vMaxMonthYear='Jun16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16")',
if(vMaxMonthYear='Jul16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16")',
if(vMaxMonthYear='Aug16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16")',
if(vMaxMonthYear='Sep16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16")',
if(vMaxMonthYear='Oct16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16")',
if(vMaxMonthYear='Nov16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16"|"Nov16")',
if(vMaxMonthYear='Dec16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16"|"Nov16"|"Dec16")',
',0))))))))))))

However when I view the variable it drops the ' and ' that I need. In other words I need to be able to chose 'Apr16' and it should return '("Jan16"|"Feb16"|"Mar16"|"Apr16")' and not ("Jan16"|"Feb16"|"Mar16"|"Apr16").

How do I repair the variable

1 Solution

Accepted Solutions
swuehl
MVP
MVP

chr(39) &

if(vMaxMonthYear='Jan16','("Jan16")',
if(vMaxMonthYear='Feb16','("Jan16"|"Feb16")',
if(vMaxMonthYear='Mar16','("Jan16"|"Feb16"|"Mar16")',
if(vMaxMonthYear='Apr16','("Jan16"|"Feb16"|"Mar16"|"Apr16")',
if(vMaxMonthYear='May16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16")',
if(vMaxMonthYear='Jun16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16")',
if(vMaxMonthYear='Jul16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16")',
if(vMaxMonthYear='Aug16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16")',
if(vMaxMonthYear='Sep16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16")',
if(vMaxMonthYear='Oct16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16")',
if(vMaxMonthYear='Nov16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16"|"Nov16")',
if(vMaxMonthYear='Dec16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16"|"Nov16"|"Dec16")',
',0))))))))))))

&chr(39)

View solution in original post

4 Replies
swuehl
MVP
MVP

chr(39) &

if(vMaxMonthYear='Jan16','("Jan16")',
if(vMaxMonthYear='Feb16','("Jan16"|"Feb16")',
if(vMaxMonthYear='Mar16','("Jan16"|"Feb16"|"Mar16")',
if(vMaxMonthYear='Apr16','("Jan16"|"Feb16"|"Mar16"|"Apr16")',
if(vMaxMonthYear='May16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16")',
if(vMaxMonthYear='Jun16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16")',
if(vMaxMonthYear='Jul16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16")',
if(vMaxMonthYear='Aug16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16")',
if(vMaxMonthYear='Sep16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16")',
if(vMaxMonthYear='Oct16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16")',
if(vMaxMonthYear='Nov16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16"|"Nov16")',
if(vMaxMonthYear='Dec16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16"|"Nov16"|"Dec16")',
',0))))))))))))

&chr(39)

Anil_Babu_Samineni

Perhaps this

chr(39) & '(' &

if(vMaxMonthYear='Jan16','("Jan16")',
if(vMaxMonthYear='Feb16','("Jan16"|"Feb16")',
if(vMaxMonthYear='Mar16','("Jan16"|"Feb16"|"Mar16")',
if(vMaxMonthYear='Apr16','("Jan16"|"Feb16"|"Mar16"|"Apr16")',
if(vMaxMonthYear='May16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16")',
if(vMaxMonthYear='Jun16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16")',
if(vMaxMonthYear='Jul16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16")',
if(vMaxMonthYear='Aug16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16")',
if(vMaxMonthYear='Sep16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16")',
if(vMaxMonthYear='Oct16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16")',
if(vMaxMonthYear='Nov16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16"|"Nov16")',
if(vMaxMonthYear='Dec16','("Jan16"|"Feb16"|"Mar16"|"Apr16"|"May16"|"Jun16"|"Jul16"|"Aug16"|"Sep16"|"Oct16"|"Nov16"|"Dec16")',
',0))))))))))))

& ')' &chr(39)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Thank you Stefan that worked absolutely perfectly

swuehl
MVP
MVP

Great, if your issue is resolved, then please close this thread by marking helpful and/or correct answers:

Qlik Community Tip: Marking Replies as Correct or Helpful