How to add a field to a Window Tab
It is closely the related to the previous How to add Columns to a Table HowTo which showed how to add new columns to a table.
In that previous HowTo the following three new columns were added to the ht_salary table.
- ValidTo, a simple date-field matching the ValidFrom date already present in this table
- Payment Schedule, shown as a combobox to the user to be able to choose from three values defined in a list-reference.
- First day of the month
- Mid of the month
- Last day of the month
- Payment Category, a link to another existing table which allows selecting among the values present in that table.
The task of adding those new columns to the existing Employee Salary window which was create in this other HowTo is now faily simple as most of the work (like defining references, element) has been already done when adding the columns to the table.
In this HowTo we will place the new fields in the module with dbprefix HT2 which already contains the new columns.
Add the fields to the window
The process to add new fields to an existing window is the same like adding fields to a new (empty) window. Going to Application Dictionary || Window, Tabs and Fields we need to search for the Employee Salary window. Then for that window mark its Salary tab.
Now we use the Create Fields process on this tab to let it add all columns of the underlying ht_salary table to this tab if they've not been previously added.
This will then add three new fields to the tab matching the three new columns and automatically place those three fields into the module with prefix HT2.
The next step is to configure those new fields a bit to get a more pleasing layout:
- EM_Ht2_ValidTo change Sequence Number' = 72, to place it right after the ValidFrom field
- EM_Ht2_Payment_Schedule change Sequence Number = 76 and Start in new Line Line = Yes to place it into a new line after the ValidTo field
- EM_Ht2_C_Salary_Category_ID change Sequence Number = 78 to place it after the Payment Schedule field
After this change the list of columns should look similar to the following screenshot:
As a last step the Synchronize Terminology process should be run to synchronize our newly added fields to the elements created for the columns they are based on so that the UI labels for the new fields get the names defined in those elements.
If this window should also be used in classic UI mode then now ant smartbuild should be execute to compile the changed window.
To see the changed in the new UI just switch role away from the System Administrator role used for this HowTo and go to the changed window to see it having the new field like shown here: