8 June 2022 The difference between SET and LET in Qlik Share this message Every Friday at Bitmetric we’re posting a new Qlik certification practice question to our LinkedIn company page. Last Friday we asked the following Qlik Data Architect certification practice question about the difference between the SET and LET statements in Qlik Sense: The correct answer is A: vLoadStart contains the date and time that the script started, vLoadEnd contains the value “Now()” Even without having edited a single letter in the Qlik script there are already SET statements to be found. Always included you will find the Main script page with a row of default settings all starting with SET. Now concerning last weeks question and answer we can be pretty clear: SET variablename = string LET variablename = expression By using SET Qlik will store the variable as the string provided, using LET will evaluate the string as an expression. Or to put it more simply: SET vString = 1+1; Will return vString = 1+1. LET vString = 1+1; Will return vString = 2. Returning to last week’s question: LET vLoadStart = Now(); Will return vLoadStart = the result of the expression now(), which is the current time of the system clock. SET vLoadEnd = Now(); Will return the string ‘Now()’. One of the main things to consider while using this is the end result and how to use it in the front end. Lets have a look at the following example: We would like to have a text object within the app in which the users can see when the load started and when it ended using the following expression: ‘Start Reload: ‘ & vLoadStart & CHR(10) & ‘End Reload: ‘ & vLoadEnd The end result will look as expected: However, if we change the variable vLoadEnd to use Dollar Sign expansion: ‘Start Reload: ‘ & vLoadStart & CHR(10) & ‘End Reload: ‘ & $(vLoadEnd) It will evaluate the text within the expansion, being Now(), which results in: While it looks better, it is definitely not correct! It is displaying the time at which Now() is evaluated (which is at the moment of calculating the Text Object) and not the time when LET has evaluated the expression within the script. The same goes for if we use the Dollar Sign expansion on vLoadStart. That will make $(vLoadStart) evaluate 08-06-2022 17:06:52, which returns a Null value, because it will start calculating 8 minus 6 minus 2022 and then run into trouble with the space and the colon, since they are not interpreted as correct symbols for calculations by Qlik. So it is worth remembering that using LET can already perform expressions in the script and using the Dollar Sign expansion might not give the exact results as expected at first hand. That’s it for this week. See you next Friday? More from the Bitmetric team Take your Qlik skills to the next level! Since 2013, the Masters Summit for Qlik is the premier advanced training for Qlik. Join us in Vienna and take your Qlik skills to the next level. Join the team! Do you want to work within a highly-skilled, informal team where craftsmanship, ingenuity, knowledge sharing and personal development are valued and encouraged? Check out our job openings. Friday Qlik Test Prep Script Solution How can we help? Barry has over 20 years experience as a Data & Analytics architect, developer, trainer and author. He will gladly help you with any questions you may have. Call us Mail us 8 October 2024 Artificial Intelligence, Machine Learning, and Deep Learning Explained: How They Impact Your Business In today’s rapidly evolving technological landscape, Artificial Intelligence (AI), Machine Learning (ML), and Deep Learning (DL) are transforming industries and redefining how businesses operate. In this blog post, we will break down these three definitions and elaborate on them. AI 25 September 2024 Building Ethical AI: Practical Frameworks for Responsible Innovation AI is transforming industries with innovation and efficiency. But with great power comes great responsibility. The real question is: How do you turn ethical principles into actionable guidelines for AI development? And what steps should your team take to make it happen? AI 17 September 2024 What is AI Ready Data Data quality is all about how accurate, consistent, complete, and up-to-date your data is. If your data is good, you’ll get reliable insights and be able to make smarter decisions. It’s a key part of making sure your AI and machine learning projects are successful. AI Qlik
8 October 2024 Artificial Intelligence, Machine Learning, and Deep Learning Explained: How They Impact Your Business In today’s rapidly evolving technological landscape, Artificial Intelligence (AI), Machine Learning (ML), and Deep Learning (DL) are transforming industries and redefining how businesses operate. In this blog post, we will break down these three definitions and elaborate on them. AI
25 September 2024 Building Ethical AI: Practical Frameworks for Responsible Innovation AI is transforming industries with innovation and efficiency. But with great power comes great responsibility. The real question is: How do you turn ethical principles into actionable guidelines for AI development? And what steps should your team take to make it happen? AI
17 September 2024 What is AI Ready Data Data quality is all about how accurate, consistent, complete, and up-to-date your data is. If your data is good, you’ll get reliable insights and be able to make smarter decisions. It’s a key part of making sure your AI and machine learning projects are successful. AI Qlik