SubField() Function in QlikView Application: Part 3

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.

After clicking New option

Step 2:
Open Edit Script

The second step is to open the edit script window from File -> Edit Script.

window of edit script

Then this window will be opened.

window

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
];

code

  1. Table1:  
  2. LOAD * Inline   
  3. [  
  4. EvenNumbers  
  5. 2,  
  6. 4,  
  7. 6,  
  8. 10,  
  9. 14,  
  10. 16,  
  11. 18  
  12. ];   
Step 4: Save file

The next step is to save our QlikView file.

save 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.

sheet

Now you will see this window. Here you can see a list box that displays in the sheet property.

main

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.

code1
  1. Table1:  
  2. LOAD * Inline   
  3. [  
  4. EvenNumbers  
  5. 2,  
  6. 4,  
  7. 6,  
  8. 10,  
  9. 14,  
  10. 16,  
  11. 18  
  12. ];  
  13.   
  14. Table2:  
  15. LOAD *,  
  16. SubField(EvenNumbers,'',-1) as NewNumbers  
  17.   
  18. RESIDENT Table1;  
  19. 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.

ssheet

Then you will see this output.

main1

Summary

This article described the Subfield function without field number

Previous article:  SubField() Function in QlikView Application: Part 2


Similar Articles