KeyPosition controls how list is sorted
Member of Tree View Column (PRIM_TVCL)
Data Type - Integer
The KeyPosition property specifies the position of the column in the tree hierarchy for levelled trees. Much like the key of a file, the key defined for a tree organises the entries. This allows the tree to create items in the tree even though there is no specific entry added. Key columns don't need to be visible, instead being used purely to define the structure. Additional columns can be added at the same Level and used for display. Typically, key columns are related to identifier information such as order number, employee IDs etc.
In this example, and 3 level tree shows department, section and employee data. DEPTMENT is used to identify Level 1 items but is hidden. DEPTDESC is used for display. SECTION is used to identify Level 2 items but is hidden. SECDESC is used for display. EMPNO is used to identify Level 3 items but is hidden. FULLNAME is used for display. The tree automatically creates items at the right level based on the data values in the key columns. The fields on the right show the field values for each item. Despite all the fields having values when added, the tree automatically creates additional items with null values in the fields that do not apply to the Level.
Function Options(*DIRECT) Begin_Com Role(*EXTENDS #PRIM_FORM) Clientheight(462) Clientwidth(748) Height(501) Layoutmanager(#TableLayout_1) Left(152) Top(225) Width(764) Define_Com Class(#PRIM_TBLO) Name(#TableLayout_1) Define_Com Class(#PRIM_TBLO.Column) Name(#Column1) Displayposition(2) Parent(#TableLayout_1) Define_Com Class(#PRIM_TBLO.Row) Name(#Row_1) Displayposition(1) Parent(#TableLayout_1) Define_Com Class(#PRIM_TBLO.Column) Name(#Column_1) Displayposition(1) Parent(#TableLayout_1) Define_Com Class(#PRIM_TBLO.Item) Name(#Item_1) Column(#Column_1) Manage(#Tree) Parent(#TableLayout_1) Row(#Row_1) Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem1) Alignment(TopLeft) Column(#Column1) Flow(Down) Manage(#DEPTMENT) Parent(#TableLayout_1) Row(#Row_1) Sizing(FitToWidth) Margintop(4) Marginleft(4) Marginright(4) Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem2) Column(#Column1) Manage(#DEPTDESC) Parent(#TableLayout_1) Row(#Row_1) Sizing(FitToWidth) Alignment(TopLeft) Flow(Down) Margintop(4) Marginleft(4) Marginright(4) Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem3) Column(#Column1) Manage(#SECTION) Parent(#TableLayout_1) Row(#Row_1) Sizing(FitToWidth) Alignment(TopLeft) Flow(Down) Margintop(4) Marginleft(4) Marginright(4) Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem4) Column(#Column1) Manage(#SECDESC) Parent(#TableLayout_1) Row(#Row_1) Sizing(FitToWidth) Alignment(TopLeft) Flow(Down) Margintop(4) Marginleft(4) Marginright(4) Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem5) Column(#Column1) Manage(#EMPNO) Parent(#TableLayout_1) Row(#Row_1) Sizing(FitToWidth) Alignment(TopLeft) Flow(Down) Margintop(4) Marginleft(4) Marginright(4) Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem6) Column(#Column1) Manage(#FULLNAME) Parent(#TableLayout_1) Row(#Row_1) Sizing(FitToWidth) Alignment(TopLeft) Flow(Down) Margintop(4) Marginleft(4) Marginright(4) Define_Com Class(#PRIM_TRVW) Name(#Tree) Columnbuttonheight(20) Componentversion(2) Displayposition(1) Fullrowselect(True) Haslines(False) Height(462) Left(0) Parent(#COM_OWNER) Tabposition(1) Top(0) Width(374) Define_Com Class(#PRIM_TVCL) Name(#TreeViewColumn1) Level(1) Parent(#Tree) Source(#DEPTMENT) Keyposition(1) Visible(False) Define_Com Class(#PRIM_TVCL) Name(#TreeViewColumn2) Displayposition(1) Level(1) Parent(#Tree) Source(#DEPTDESC) Sortposition(1) Define_Com Class(#PRIM_TVCL) Name(#TreeViewColumn3) Level(2) Parent(#Tree) Source(#SECTION) Keyposition(1) Visible(False) Define_Com Class(#PRIM_TVCL) Name(#TreeViewColumn4) Displayposition(1) Level(2) Parent(#Tree) Source(#SECDESC) Sortposition(1) Define_Com Class(#PRIM_TVCL) Name(#TreeViewColumn5) Level(3) Parent(#Tree) Source(#EMPNO) Visible(False) Define_Com Class(#PRIM_TVCL) Name(#TreeViewColumn6) Displayposition(1) Level(3) Parent(#Tree) Source(#FULLNAME) Sortposition(1) Define_Com Class(#DEPTMENT.Visual) Name(#DEPTMENT) Displayposition(2) Left(378) Parent(#COM_OWNER) Tabposition(2) Top(4) Width(366) Readonly(True) Define_Com Class(#DEPTDESC.Visual) Name(#DEPTDESC) Displayposition(3) Left(378) Parent(#COM_OWNER) Tabposition(3) Top(29) Width(366) Readonly(True) Define_Com Class(#SECTION.Visual) Name(#SECTION) Displayposition(4) Left(378) Parent(#COM_OWNER) Tabposition(4) Top(54) Width(366) Readonly(True) Define_Com Class(#SECDESC.Visual) Name(#SECDESC) Displayposition(5) Left(378) Parent(#COM_OWNER) Tabposition(5) Top(79) Width(366) Readonly(True) Define_Com Class(#EMPNO.Visual) Name(#EMPNO) Componentversion(1) Displayposition(6) Height(21) Left(378) Parent(#COM_OWNER) Tabposition(6) Usepicklist(False) Width(366) Top(104) Readonly(True) Define_Com Class(#FULLNAME.Visual) Name(#FULLNAME) Displayposition(7) Left(378) Parent(#COM_OWNER) Tabposition(7) Top(129) Width(366) Readonly(True) Evtroutine Handling(#Com_owner.CreateInstance) #Com_owner.Load Endroutine Mthroutine Name(Load) Select Fields(*All) From_File(PSLMST) Fetch Fields(#deptdesc) From_File(Deptab) With_Key(#deptment) Keep_Last(100) Fetch Fields(#secdesc) From_File(Sectab) With_Key(#deptment #section) Keep_Last(100) #Fullname := ("&1, &2 (&3)").Substitute( #Surname #Givename #Empno ) Add_Entry To_List(#Tree) Endselect Endroutine End_Com
Febuary 18 V14SP2