Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
micheledenardi
Specialist II
Specialist II

carriage return on script

i have very long formula in qlik script and i want to know if there is the possibility to carriage return inside my formula to obtain this:

if(condition1,value1,

if(condition2,value2,

if(condition3, value3, value4))) as [my value];

thank's

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
1 Solution

Accepted Solutions
svenkita
Creator II
Creator II

YES it is possible,

Sample Code

Load TempDate as Star_Date,

if (Num(Month(TempDate)) = 7 , 1,

     if (Num(Month(TempDate)) = 8 , 1,   

     if (Num(Month(TempDate)) = 9 , 1,   

     if (Num(Month(TempDate)) = 10 , 2,   

     if (Num(Month(TempDate)) = 11 , 2,   

     if (Num(Month(TempDate)) = 12 , 2,   

     if (Num(Month(TempDate)) = 1 , 3,   

     if (Num(Month(TempDate)) = 2 , 3,   

     if (Num(Month(TempDate)) = 3 , 3,   

     if (Num(Month(TempDate)) = 4 , 4,   

     if (Num(Month(TempDate)) = 5 , 4,   

     if (Num(Month(TempDate)) = 6 , 4,   

     ))))))))))))                                               As StarFiscalQuarter

Resident TmpCalendar;

View solution in original post

4 Replies
stigchel
Partner - Master
Partner - Master

Have you tried? But yes it is possible.

From the help

Script Statements and Keywords

The QlikView script consists of a number of statements. A statement can be either a regular script statement or a Script Control Statements. Certain statements can be preceded by prefixes.

Regular statements are typically used for manipulating data in one way or another. These statements may be written over any number of lines in the script and must always be terminated by a semicolon, ";".

Control statements are typically used for controlling the flow of the script execution. Each clause of a control statement must be kept inside one script line and may be terminated by a semicolon or the end-of-line.

Prefixes may be applied to applicable regular statements but never to control statements. The when and unless prefixes can however be used as suffixes to a few specific control statement clauses.

In the next subchapter, an alphabetical listing of all script statements, control statements and prefixes, are found.

All script keywords can be typed with any combination of lower case and upper case characters. Field and variable names used in the statements are however case sensitive

svenkita
Creator II
Creator II

YES it is possible,

Sample Code

Load TempDate as Star_Date,

if (Num(Month(TempDate)) = 7 , 1,

     if (Num(Month(TempDate)) = 8 , 1,   

     if (Num(Month(TempDate)) = 9 , 1,   

     if (Num(Month(TempDate)) = 10 , 2,   

     if (Num(Month(TempDate)) = 11 , 2,   

     if (Num(Month(TempDate)) = 12 , 2,   

     if (Num(Month(TempDate)) = 1 , 3,   

     if (Num(Month(TempDate)) = 2 , 3,   

     if (Num(Month(TempDate)) = 3 , 3,   

     if (Num(Month(TempDate)) = 4 , 4,   

     if (Num(Month(TempDate)) = 5 , 4,   

     if (Num(Month(TempDate)) = 6 , 4,   

     ))))))))))))                                               As StarFiscalQuarter

Resident TmpCalendar;

jagan
Luminary Alumni
Luminary Alumni

Hi,

Yes this is possible.

TableName:

LOAD

*,

if(condition1,value1,

if(condition2,value2,

if(condition3, value3, value4))) as [my value]

FROM TableName;

florentina_doga
Partner - Creator III
Partner - Creator III

use chr(10)=lf in expresion