I want to create a Listbox with a Treeview for ProductGroups.
This QVD will be loaded for the Listbox
The fields LeafCode, Level01Code, Level02Code, Level03Code & Level04Code should be the Levels in my Listbox. Where LeafCode is the Parent and the Level xx Code are the Children. In every example I saw, there are always Parent-ID, ChildID's, Path, '-' and HierarchyLevel. I don't have them in my QVD.
When I use the QLIKVIEW LOADStatement I can take the Option Hierarchy : HIERARCHY(Level01Code, LeafCode, Level01Name, LeafName, Path, '-', HierarchyLevel )
When I run the script I have no Problems, only there is no Hierarchy so I can not use the TreeView option
I fear that's the default-behaviour from a treeview-listbox and I think a field-creation with the hierarchy-statement won't change that. Here are several links to this topic included (in the correct answer) and especially the approach from the second link: Tree View Hierarchy - select entire group? could be a workaround for you.
I'm not sure how NULL's (the various kinds of NULL) will affect your wished usability - if it's per default not worked like you expect it then you will need to replace them with real values like: '#NV', 'no value', 'EMPTY', ' ' or anything you like. I think you could use for this something like:
if(len(trim(LevelXCode)) = 0, 'YourReplacevalue', LevelXCode) as LevelXCode
I have spoken with my colleague who looks after the DataWareHouse.
He will try to to change the hierarchy-structure of the QVD's so that I can load them with a Hierarchy Loadstatement. One (new) point in the new structure will be a new column for Parent and Child ID's which is important for the loadstatement.