Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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;
Have you tried? But yes it is possible.
From the help
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
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;
Hi,
Yes this is possible.
TableName:
LOAD
*,
if(condition1,value1,
if(condition2,value2,
if(condition3, value3, value4))) as [my value]
FROM TableName;
use chr(10)=lf in expresion