Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Applicable88
Creator III
Creator III

Single quotes in if statment and double quotes in set expression

Hello,

why in a set expression the date today function is in a double quote:

count({<[EndterminEck.autoCalendar.Date]={"$(=Date(Today()+2))"}>} Orders)

and in a if statement it should be like this:

count(if([EndterminEck.autoCalendar.Date]='$(=Date(Today()+2))',Orders))

aren't both a kind of DSE?

Thanks in advance.

Best. 

 

4 Solutions

Accepted Solutions
Vegar
MVP
MVP

In set double quotes are evaluated and single are not. In your case it should have been sufficient with single in both if and set statement.

You would normally use double if you where to compare, let's say dates lather than your expression would look like this :

count({<[EndterminEck.autoCalendar.Date]={">=$(=Date(Today()+2))"}>} Orders)

 If you where looking for a date value that contained the >=symbols you would use single. 

View solution in original post

Saravanan_Desingh

In Set Analysis, the single quote represents a String and the double quote used for Search Argument.

In the IF statement also, the single quote been used for String representation.

BTW, in your COUNT-IF I still think the DSE is not needed.

View solution in original post

tresesco
MVP
MVP

@Applicable88 , I am impressed with the way you are approaching the qlik learning. Your questions and counter -questions (that I have been noticing in recent couple of days in community)are really good. I would recommend you to read blogs written by @hic . That would make your base of Qlik understanding strong.

For this specific question, read: https://community.qlik.com/t5/Qlik-Design-Blog/Quotes-in-Set-Analysis/ba-p/1471824

View solution in original post

hic
Former Employee
Former Employee

In set analysis, looking for a specific date, both will work:
    {<Date={"$(=Date(Today()+2))"}>}
    {<Date={'$(=Date(Today()+2))'}>}
The first will treat the content as a search string, and the second will treat it as an exact match. But the result will be the same.

However, if you want to make a real search where the result may be several dates, you must use double quotes:
    {<Date={">$(=Date(Today()+2))"}>}
Single quotes would make it look for a string beginning with '>'.

Finally, in an if-function single quotes will denote a field value (which is what you want), whereas double quotes will denote a field name.

HIC

View solution in original post

5 Replies
Vegar
MVP
MVP

In set double quotes are evaluated and single are not. In your case it should have been sufficient with single in both if and set statement.

You would normally use double if you where to compare, let's say dates lather than your expression would look like this :

count({<[EndterminEck.autoCalendar.Date]={">=$(=Date(Today()+2))"}>} Orders)

 If you where looking for a date value that contained the >=symbols you would use single. 

Saravanan_Desingh

In Set Analysis, the single quote represents a String and the double quote used for Search Argument.

In the IF statement also, the single quote been used for String representation.

BTW, in your COUNT-IF I still think the DSE is not needed.

Applicable88
Creator III
Creator III
Author

Hello @Vegar ,

Can you explain to me a little more:

"In set double quotes are evaluated and single are not. In your case it should have been sufficient with single in both if and set statement." 

So isn't my double quotes needs to "evaluate" my function? So why it also works well with single quotes?

 

In your example you used that '>=:

count({<[EndterminEck.autoCalendar.Date]={">=$(=Date(Today()+2))"}>} Orders)

"If you where looking for a date value that contained the >=symbols you would use single."

But still you use double quotes?

Thanks in advance. 

tresesco
MVP
MVP

@Applicable88 , I am impressed with the way you are approaching the qlik learning. Your questions and counter -questions (that I have been noticing in recent couple of days in community)are really good. I would recommend you to read blogs written by @hic . That would make your base of Qlik understanding strong.

For this specific question, read: https://community.qlik.com/t5/Qlik-Design-Blog/Quotes-in-Set-Analysis/ba-p/1471824

hic
Former Employee
Former Employee

In set analysis, looking for a specific date, both will work:
    {<Date={"$(=Date(Today()+2))"}>}
    {<Date={'$(=Date(Today()+2))'}>}
The first will treat the content as a search string, and the second will treat it as an exact match. But the result will be the same.

However, if you want to make a real search where the result may be several dates, you must use double quotes:
    {<Date={">$(=Date(Today()+2))"}>}
Single quotes would make it look for a string beginning with '>'.

Finally, in an if-function single quotes will denote a field value (which is what you want), whereas double quotes will denote a field name.

HIC