Search This Blog

Monday, August 5, 2013

Field Label : Importance of Label ID and its usage

Field Definition: Importance of Label ID and its usage

When you create a new Field Definition in PeopleSoft, you not only choose Field Type/Length/Format but also you enter the Label for the field which should appear on the page.

So it makes a logical sense, to have atleast one Label ID for a field. This will be the Default Label.

Suppose that the same field definition should display different Labels in different pages. In such a case, we go for multiple labels.

In case of Multiple labels, if no default label is selected then the first one in the list will be treated as 'Default label'.

Below are the various places in PeopleSoft where we come across the Labels for a field that should be displayed on the page.

1. Field Definition Level
2. Record Field Properties Level
3. Page Field Properties Level
4. Peoplecode

Lets see each of them in detail.

1. Field Definition Level:
Lets take Example of EMPLID  field. You can see that the default Label ID here is EMPLID and hence the Name which is used for this Label Id will be displayed on the page. But which name would come up Long Name or Short Name. This can verified by simply creating a dummy page and inserting field on the page. In the Field Properties, you can see that By Default RFT Long Name gets selected.

Also Label ID can be same as Field Name.In this case both the Field Name and Default Label ID are same.

Some Rules while creating Field Label:
The LabelID should not contain any spaces. 
The other Labels for EMPLID are as shown above.

2. Record Field Properties Level:
Lets talk of a scenario where we want Label ID 'EMPLID3' (row number 20 in the above image)
instead of Default Label 'EMPLID'.
 This can done at Record Field Properties as shown below.
In the below snapshot, Defualt Label ID is used at Record Field Properties.

It can be observed that the precedence of values shown in DropDown list. Label ID followed by Short Name and then Long Name.
Now lets change the Record Field Label ID to the one which is desired. In this case, it is 'EMPLID3'.

So now the Name for the Label ID 'EMPLID3' will be displayed on the page.
To know which Name should be displayed, let's see the Page Field Properties
3. Page Field Properties Level
From the image below, we can set the Label as either None/Text/RFT Short/RFT Long.
When RFT Short/Long is selected appropriate value will get displayed for the Label ID 'EMPLID3'.

4. At Peoplecode Level.  
Also through peoplecode you can change the label of field that is displayed on the page using Field Class.
The label appearing on the page can changed by using below code.
The code checks the page name and if it is JOBDATA page then LongDescr which is set for the LABEL (‘EMPLID’) will be displayed on the page and vice-versa.

Local Field &FIELD;
   If %Page = PAGE.JOBDATA Then
      &FIELD.Label = &FIELD.GetLongLabel("EMPLID");
   Else If %Page = PAGE.STUDENTAPPL Then
      &FIELD.Label = &FIELD.GetLongLabel("EMPLID3");

Note:  JOBDATA,STUDENTAPPL  are Dummy Page Names used in the above example and ‘EMPLID’/’ID’ are the labels that will be displayed based on the condition. 

Peopletools MetaTables
PSDBFIELD -- Stores Field Definitions
PSDBFLDLABL -- Stores the Field Labels

This concludes the importance and usage of Label ID in PeopleSoft.

No comments: