In my previous article I described Subfield function in QlikView : Part 1 using a table field number. The Subfield function is the most loving feature of QlikView because it avoids duplicate records.
But in this article I describe the Subfield function in QlikView without field number. In this article I did not import any Excel file.
The following is the basic procedure for using the Subfield function without field number.
Step 1: Open QlikView application
In the first step you need to open the QlikView application then go to File -> New, then this window will be opened.
Step 2: Open Edit Script
The second step is to open the edit script window from File -> Edit Script.
Then this window will be opened.
Step 3: Write the code and reload it.
The next step is to write some code by inline load. The inline load can define its own data to be loaded within a QlikView edit script. The inline data can be defined in the inline data wizard. The Load order is used for default sorting. It can also be used for setting color and order. It can be used by two functions like FieldValue() and FieldIndex().
The FieldValue() function returns the value of a field and FieldIndex() returns either the value or reference to a value from a table.
Example
LOAD * INLINE [
A
B
C
D
];
- Table1:
- LOAD * Inline
- [
- EvenNumbers
- 2,
- 4,
- 6,
- 10,
- 14,
- 16,
- 18
- ];
Step 4: Save file
The next step is to save our QlikView file.
Step 5: Sheet property window.
The sheet property window will be opened. In this window you add fields that you want to display as a table and click on the OK button.
Now you will see this window. Here you can see a list box that displays in the sheet property.
Step 6: Apply the subfield function in the edit script
The next step is to open the edit script window again and apply the subfield function and reload it.
- Table1:
- LOAD * Inline
- [
- EvenNumbers
- 2,
- 4,
- 6,
- 10,
- 14,
- 16,
- 18
- ];
-
- Table2:
- LOAD *,
- SubField(EvenNumbers,'',-1) as NewNumbers
-
- RESIDENT Table1;
- DROP Table Table1;
Here, you can see in this example I apply the Subfield function in EvenNumbers field as NewNumbers. Now see after applying the subfield function what happens. Such as it is very interesting!
Then sheet property window will be opened, here a new field is generated. Then add these fields.
Then you will see this output.
Summary
This article described the Subfield function without field number
Previous article:
SubField() Function in QlikView Application: Part 2