

{"id":44508,"date":"2018-12-07T12:45:00","date_gmt":"2018-12-07T07:15:00","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=44508"},"modified":"2018-12-06T17:45:44","modified_gmt":"2018-12-06T12:15:44","slug":"qlik-sense-script-syntax","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/","title":{"rendered":"Qlik Sense Script Syntax &#8211; Backus-Naur Formalism"},"content":{"rendered":"<h2><span style=\"font-weight: 400\">1. Objective<\/span><\/h2>\n<p><span style=\"font-weight: 400\">In our last session, we discussed <a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-visualization-expressions\/\"><strong>Qlik Sense Visualization Expression<\/strong><\/a>. Today, we will see Qlik Sense Script Syntax. In this lesson, we are going to learn about how data tables are loaded or written in the data load script of Qlik Sense. Also, we will start with understanding the standard script notation (BNF) which is followed to write codes in the script. Moreover, we will see what types of script statements and keywords are used in the script and how to the script expression is written.<\/span><\/p>\n<p>So, let&#8217;s start the Qlik Sense Script Syntax Tutorial.<\/p>\n<div id=\"attachment_44564\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-44564\" class=\"size-full wp-image-44564\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01.jpg\" alt=\"Qlik Sense Script Syntax - Backus-Naur Formalism\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01-1024x536.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01-520x272.jpg 520w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-44564\" class=\"wp-caption-text\">Qlik Sense Script Syntax &#8211; Backus-Naur Formalism<\/p><\/div>\n<h2><span style=\"font-weight: 400\">2. What is Qlik Sense Script Syntax?<\/span><\/h2>\n<p><span style=\"font-weight: 400\">In a data load script, various operations are performed for which script statements and keywords are required. The script code should be written in such a format or notation which is correct and readable for the machine. The script statements are executed consecutively if the code syntax is error free. You must always remember to end a script statement or each code line with a semicolon \u2018<\/span><b>;<\/b><span style=\"font-weight: 400\">\u2019 The operations performed through a script are, establishing a data connection, loading a data table, loading field names, and values, etc.<\/span><\/p>\n<p><strong>Recommended Reading &#8211;<\/strong> <strong><a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-logical-functions\/\">Qlik Sense Logical Functions<\/a><\/strong><\/p>\n<p><span style=\"font-weight: 400\">A certain initial piece of code is generated upon creating of a new file, setting up all the basic properties like number interpretation variables, formats etc. The two main keywords used for loading data are LOAD and SELECT. Under the LOAD statement, you can use expressions and functions to manipulate data as you like. <\/span><\/p>\n<h2><span style=\"font-weight: 400\">3. What is Backus-Naur Formalism?<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Backus-Naur Form is a metalanguage. Metalanguages are the languages which are used to explain other natural or computer languages. Any metalanguage follows a specific notation technique or meta syntax through which rules of a language are defined and explained. In the world of computing, there are several widely used metalanguages are <\/span><i><span style=\"font-weight: 400\">Backus-Naur Form (BNF),<\/span><\/i> <i><span style=\"font-weight: 400\">Extended Backus-Naur Form (EBNF)<\/span><\/i><span style=\"font-weight: 400\">, <\/span><i><span style=\"font-weight: 400\">Augmented Backus-Naur Form (ABNF).<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400\">Formulating a language for computers in a well-defined and formatted structure is very important for the language to be properly converted into a machine language during execution.<\/span><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-mapping-function\/\">Let&#8217;s discuss Qlik Sense Mapping function<\/a><\/strong><\/p>\n<p><span style=\"font-weight: 400\">The Backus-Naur Form is designed in a specific way with a set of derivation rules expressed as,<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;symbol&gt; ::= __expression__<\/pre>\n<p><span style=\"font-weight: 400\">Every BNF statement follows this rule, where the Symbol is a value defined using \u2018::=\u2019 sign and the __expression__ are the possible and valid variables that can taken up for the defined value. Let us understand this by dividing the above statement into a right half and a left half. The right half has a Non-terminal value and the left half has Terminal values. <\/span><\/p>\n<p><strong>a. Non-Terminals\u00a0<\/strong><span style=\"font-weight: 400\"><strong>&#8211;<\/strong> The Non-terminals are syntactic or lexical entities that are used to define a symbol to be used in a language abiding the formal grammar rules. These are always enclosed in &lt;&gt;. <\/span><\/p>\n<p><strong>b. Terminals\u00a0<\/strong><span style=\"font-weight: 400\"><strong>&#8211;<\/strong> The Terminals are symbols\/values that are the probable outcomes of the defined (non-terminal entity\/symbol) as per the rule. These values are not susceptible to change by the rule.<\/span><\/p>\n<p><span style=\"font-weight: 400\">In an expression, let\u2019s suppose that we are defining an entity &lt;digit&gt; then on the right side of the expression will be all the terminal values i.e. the possible values that can be taken up by the system as Digits like 0,1,2,3.. etc. <\/span><\/p>\n<div id=\"attachment_44559\" style=\"width: 905px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Backus-Naur-Formalism.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-44559\" class=\"size-full wp-image-44559\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Backus-Naur-Formalism.png\" alt=\"Script Syntax\" width=\"895\" height=\"253\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Backus-Naur-Formalism.png 895w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Backus-Naur-Formalism-150x42.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Backus-Naur-Formalism-300x85.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Backus-Naur-Formalism-768x217.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Backus-Naur-Formalism-520x147.png 520w\" sizes=\"auto, (max-width: 895px) 100vw, 895px\" \/><\/a><p id=\"caption-attachment-44559\" class=\"wp-caption-text\">Script Syntax &#8211; Backus Naur Formalism<\/p><\/div>\n<p><span style=\"font-weight: 400\">The values or symbol sequences defined on the right are separated by \u201c|\u201d, in case of more than one values. A Non-Terminal can also be defined in or replaced by one or more Non-Terminals on the right side. For instance, if after defining &lt;digits&gt; we want to define &lt;integer&gt; we can do it by creating a rule so that integer is replaced by one or more digits.<\/span><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-null-functions\/\">Have a look at Qlik Sense Null Functions<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;integer&gt; ::= &lt;digit&gt; | &lt;digit&gt;&lt;digit&gt;<\/pre>\n<p><span style=\"font-weight: 400\">Here, both &lt;integer&gt; and &lt;digit&gt; are Non-Terminals and will give an output like,<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;integer&gt; ::= 5\r\n&lt;integer&gt; ::= 86<\/pre>\n<h2><span style=\"font-weight: 400\">4. Script Statements and Keywords<\/span><\/h2>\n<p><span style=\"font-weight: 400\">The script statements and keywords are the words or characters whose purpose or operation is pre-defined in the script. There is a total of three types of script statements, i.e. script regular statements, script control statements, and script prefixes. <\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>a.<\/strong> The <\/span><i><span style=\"font-weight: 400\">script regular statements<\/span><\/i><span style=\"font-weight: 400\"> are used to manipulate data in some general ways. You can apply these statements over numerous code lines. You must always end a script regular statement with a semicolon \u2018<\/span><b>;<\/b><span style=\"font-weight: 400\">\u2019. Given below, are all the script regular functions used in Qlik Sense script.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Alias \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">AutoNumber<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Binary<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Comment field<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Comment table<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Connect<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Declare<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Derive<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Direct Query<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Directory<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Disconnect<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Drop field<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Drop table<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Execute<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">FlushLog<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Force<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Load<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Let<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Loosen Table<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Map<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">NullAsNull<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">NullAsValue<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Qualify<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Rem<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Rename field<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Rename table<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Search<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Section<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Set<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Sleep<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">SQL<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">SQLColumns<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">SQLTables<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">SQLTypes<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Star<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Store<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Tag<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Trace<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Unmap<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Unqualify<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Untag<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\"><strong>b.<\/strong> The <\/span><i><span style=\"font-weight: 400\">script control statements<\/span><\/i><span style=\"font-weight: 400\"> are responsible for managing the execution flow of the script statement. That is, they decide which statement to execute before the other. Such statements should be kept under a script line and be eliminated using the semicolon or end-of-line. Given below are some of the commonly used script control statements in Qlik Sense.<\/span><\/p>\n<p><strong>Recommended Reading &#8211;<\/strong> <strong><a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-line-chart\/\">Qlik Sense Line Chart<\/a><\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Call<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Do..loop<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Exit script<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">For..next<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">For each..next<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">If..then..elseif..else..end if<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Sub..end sub<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Switch..case..default..end switch<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\"><strong>c.<\/strong> The <\/span><i><span style=\"font-weight: 400\">script prefixes<\/span><\/i><span style=\"font-weight: 400\"> are used before script statements. Although these prefixes can only be used with script regular statements and as a suffix (<\/span><b>when<\/b><span style=\"font-weight: 400\"> and <\/span><b>unless<\/b><span style=\"font-weight: 400\">) for some control statements. Given below are the prefixes used in Qlik Sense script statements. <\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Add<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Buffer<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Concatenate<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Crosstable<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">First<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Generic<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Hierarchy<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">HierarchyBelongsTo<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Inner<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">IntervalMatch<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Join<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Keep<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Left<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Mapping<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">NoConcatenate<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Outer<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Replace<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Right<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Sample<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Semantic<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Unless<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">When<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400\">5. Variables in Data Load Editor<\/span><\/h2>\n<p><span style=\"font-weight: 400\">The variables are like storage places or containers for numeric, alphanumeric or string values. A variable is defined in the beginning and can change its value accordingly which will reflect in all the places where that variable is used in the script. The variables are defined either in the variable overview section or in the script in the data load editor. You can define a variable and assign a value to it using the <\/span><b>Let<\/b><span style=\"font-weight: 400\"> and <\/span><b>Set<\/b><span style=\"font-weight: 400\"> statements in the data load script.<\/span><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-conditional-functions\/\">You must read Qlik Sense Conditional Functions<\/a><\/strong><\/p>\n<p><span style=\"font-weight: 400\">Whenever you assign a value to a variable, then upon script execution, that value is shown as a final result. But, if you use a \u2018=\u2019 sign, then the value of the variable is evaluated as an expression and the result of evaluation is returned. Variable values are evaluated under a formula and a result is returned. Variables are used when you want to use the same value or the same type of string or text many times within a string, for example, you can store a file path in a variable and use it later anywhere in the string. <\/span><\/p>\n<h3>i. Defining a variable<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">set variablename = string<\/pre>\n<p><span style=\"font-weight: 400\">A variable is defined by using two statements Set and Let. <\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">set variablename = string<\/pre>\n<p><span style=\"font-weight: 400\">That is, set is used to assign a string value to a variable. For example,<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Set name = Chris;\r\nor\r\nlet variable = expression<\/pre>\n<p><span style=\"font-weight: 400\">Let is used to assign a numeric value or a value which can be used in calculations to a variable. For example, <\/span><\/p>\n<p><span style=\"font-weight: 400\">let <\/span><span style=\"font-weight: 400\">Days = Count(Today());<\/span><span style=\"font-weight: 400\"> \/\/ returns the total number of entries done in the field \u2018Today\u2019 and assign the value in the variable Day. <\/span><\/p>\n<h3>ii. Variable calculation<\/h3>\n<p><span style=\"font-weight: 400\">The variable calculation takes place when you define variables using the Let statement and the functions you use in the statements. To understand it better, look at the sample data given below. Using this data, we will perform calculations. <\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">LOAD * INLINE [\r\n\u00a0\u00a0\u00a0Customer, Sales\r\n\u00a0\u00a0\u00a0A, 150\r\n\u00a0\u00a0\u00a0A, 200\r\n\u00a0\u00a0\u00a0B, 240\r\n\u00a0\u00a0\u00a0B, 230\r\n\u00a0\u00a0\u00a0C, 410\r\n\u00a0\u00a0\u00a0C, 330\r\n];<\/pre>\n<p><span style=\"font-weight: 400\">Now, we will calculate two different things here, one will calculate the sum of the sales as per customer, i.e. individually for customers A, B, and C. The second statement will evaluate the total sales of all the customers. <\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Let cSales \u00a0= 'Sum(Sales)' ;\r\nLet tSales \u00a0= '=Sum(Sales)' ;<\/pre>\n<p>You must read &#8211; <strong><a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-mathematical-functions\/\">Qlik Sense Mathematical Functions<\/a><\/strong><\/p>\n<p><span style=\"font-weight: 400\">In order to get the result of the evaluation in the table, we will use dollar signs in front of each Sum(Sales) statement like =$(cSales) and =$(tSales). By doing so, the variable is calculated and then expanded, and the result of the evaluation is return. If you do not use the dollar sign, then only strings will be returned by the statement. <\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Customer<\/b><\/td>\n<td><b>$(cSales)<\/b><\/td>\n<td><b>$(tSales)<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">A<\/span><\/td>\n<td><span style=\"font-weight: 400\">350<\/span><\/td>\n<td><span style=\"font-weight: 400\">1560<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">B<\/span><\/td>\n<td><span style=\"font-weight: 400\">470<\/span><\/td>\n<td><span style=\"font-weight: 400\">1560<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">C<\/span><\/td>\n<td><span style=\"font-weight: 400\">740<\/span><\/td>\n<td><span style=\"font-weight: 400\">1560<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400\">If you wish to delete a variable, then you can do so by deleting it from the variable overview. <\/span><\/p>\n<h2><span style=\"font-weight: 400\">6. Qlik Sense Script Expressions <\/span><\/h2>\n<p><span style=\"font-weight: 400\">The script expressions are a piece of code which contains a combination of functions, fields, and operators written in the standard notation or syntax. During script execution, the elements of the script expression are evaluated, and the result which is returned as a string or number. If the script expression contains a logical function, then the result will be 0 for False, or -1 for True. <\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Expression ::=(constant | fieldref | operator1 expression | expression operator2 expression | function | ( expression ))<\/pre>\n<p><span style=\"font-weight: 400\">Where, <\/span><b>constant<\/b><span style=\"font-weight: 400\"> can be a <strong><a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-string-functions\/\">string<\/a><\/strong> or a number enclosed in single quotation marks. The string can be text, date or time, whereas, a number can be n digits long, but it must not be separated by a decimal or thousands separator. <\/span><\/p>\n<p><b>Fieldref<\/b><span style=\"font-weight: 400\"> is the field name of the table that will be loaded.<\/span><\/p>\n<p><b>Operator1<\/b><span style=\"font-weight: 400\"> is a unary operator which will work on the expression to its right. <\/span><\/p>\n<p><b>Operator2<\/b><span style=\"font-weight: 400\"> is a binary operator which works on the expressions on both the sides. <\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">function ::= functionname( parameters\r\nparameters ::= expression { , expression }<\/pre>\n<p><span style=\"font-weight: 400\">Nesting of <a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-in-function\/\"><strong>functions<\/strong><\/a> and <a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-visualization-expressions\/\"><strong>expressions<\/strong><\/a> can be done freely as long as it does not go out of the comprehension of the system\u2019s logic.<\/span><\/p>\n<p>So, this was all in Qlik Sense Script Syntax. Hope you like our explanation.<\/p>\n<h2><span style=\"font-weight: 400\">7. Conclusion <\/span><\/h2>\n<p><span style=\"font-weight: 400\">This concludes our lesson on the Qlik Sense Script Syntax. We hope it helps you in working with the data load script in Qlik Sense better. However, if you have any queries related to Qlik Sense Script Syntax, drop your comments in the comment box below and we will be happy to help.<\/span><\/p>\n<p><strong>See also &#8211;\u00a0<\/strong><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-career\/\">Qlik Sense Career Opportunities<\/a><\/strong><\/p>\n<p><strong><a href=\"https:\/\/help.qlik.com\/en-US\/sense\/November2018\/Subsystems\/Hub\/Content\/Sense_Hub\/Scripting\/script-syntax.htm\">Reference for Qlik Sense<\/a><\/strong><span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1705,&quot;href&quot;:&quot;https:\\\/\\\/help.qlik.com\\\/en-US\\\/sense\\\/November2018\\\/Subsystems\\\/Hub\\\/Content\\\/Sense_Hub\\\/Scripting\\\/script-syntax.htm&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251209191536\\\/https:\\\/\\\/help.qlik.com\\\/en-US\\\/sense\\\/November2018\\\/Subsystems\\\/Hub\\\/Content\\\/Sense_Hub\\\/Scripting\\\/script-syntax.htm&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-13 23:07:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-25 13:37:17&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-30 15:32:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-08 10:00:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-13 08:55:08&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-18 11:24:26&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-24 11:00:03&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-31 08:04:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-06 13:22:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-14 09:07:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-17 19:41:53&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-25 11:14:33&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-02 00:01:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-06 15:15:38&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-11 14:31:58&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-14 20:01:07&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-19 10:34:06&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-23 11:52:12&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-27 10:03:18&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-02 15:02:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-13 12:29:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-30 13:35:00&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-04 17:43:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-16 08:09:05&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-04 15:00:00&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-08 04:42:12&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-16 20:18:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-21 13:09:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-26 01:25:53&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-01 13:42:52&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-07-01 13:42:52&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Objective In our last session, we discussed Qlik Sense Visualization Expression. Today, we will see Qlik Sense Script Syntax. In this lesson, we are going to learn about how data tables are loaded&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":44564,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17408],"tags":[17088,17865,17860,17863,17861,17864,17862],"class_list":["post-44508","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-qlik-sense-tutorials","tag-backus-naur-form","tag-qlik-sense-script-expressions","tag-qlik-sense-script-syntax","tag-script-statements-and-keywords","tag-script-syntax-in-qlik-sense","tag-variables-in-data-load-editor","tag-what-is-qlik-sense-script-syntax"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Qlik Sense Script Syntax - Backus-Naur Formalism - DataFlair<\/title>\n<meta name=\"description\" content=\"Qlik Sense Script syntax,what is backus naur formalism, qlik sense script expressions, script statements and keywords, variables in data load editor\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Qlik Sense Script Syntax - Backus-Naur Formalism - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Qlik Sense Script syntax,what is backus naur formalism, qlik sense script expressions, script statements and keywords, variables in data load editor\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-07T07:15:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Qlik Sense Script Syntax - Backus-Naur Formalism - DataFlair","description":"Qlik Sense Script syntax,what is backus naur formalism, qlik sense script expressions, script statements and keywords, variables in data load editor","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/","og_locale":"en_US","og_type":"article","og_title":"Qlik Sense Script Syntax - Backus-Naur Formalism - DataFlair","og_description":"Qlik Sense Script syntax,what is backus naur formalism, qlik sense script expressions, script statements and keywords, variables in data load editor","og_url":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-12-07T07:15:00+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Qlik Sense Script Syntax &#8211; Backus-Naur Formalism","datePublished":"2018-12-07T07:15:00+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/"},"wordCount":1670,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01.jpg","keywords":["backus naur form","Qlik Sense Script Expressions","Qlik Sense Script Syntax","Script Statements and Keywords","Script Syntax in Qlik Sense","Variables in Data Load Editor","What is Qlik Sense Script Syntax"],"articleSection":["Qlik Sense Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/","url":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/","name":"Qlik Sense Script Syntax - Backus-Naur Formalism - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01.jpg","datePublished":"2018-12-07T07:15:00+00:00","description":"Qlik Sense Script syntax,what is backus naur formalism, qlik sense script expressions, script statements and keywords, variables in data load editor","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/12\/Qlik-Sense-Script-Syntax-01.jpg","width":1200,"height":628,"caption":"Qlik Sense Script Syntax - Backus-Naur Formalism"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/qlik-sense-script-syntax\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Qlik Sense Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/qlik-sense-tutorials\/"},{"@type":"ListItem","position":3,"name":"Qlik Sense Script Syntax &#8211; Backus-Naur Formalism"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/44508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=44508"}],"version-history":[{"count":3,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/44508\/revisions"}],"predecessor-version":[{"id":44565,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/44508\/revisions\/44565"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/44564"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=44508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=44508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=44508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}