5.3.1 Using Field Labels and Descriptions from the LANSA Repository
The following example retrieves field descriptions from the LANSA Repository to be used on the screen (e.g. Skill, Skill Code and Description). Using the names & descriptions that are stored centrally in the Repository ensures that you maintain consistency between all users of the system and allows you to easily accommodate different languages.
'set field labels and lengths by reading
'their definitions from dictionary
'Fill the buffer with as many zeroes as specified in the
'FIELD_DATA_SIZE constant in LCOE1632 module
sBuff = String(FIELD_DATA_SIZE, Chr(0))
'Get skill code label
iRet = LceGetFieldLabel(iSession, "SKILCODE", sBuff)
lbCode.Caption = sTrim(sBuff)
'---------------------------------------------------
'Get skill description label
sBuff = String(FIELD_DATA_SIZE, Chr(0))
iRet = LceGetFieldLabel(iSession, "SKILDESC", sBuff)
lbDesc.Caption = sTrim(sBuff)
Note: The sTrim function used above can be found in the UTIL.BAS module of the employee sample program.
Retrieve the SKILCODE field's long description from the LANSA Repository and display it in the status bar at the bottom of the form.
sBuff = String(FIELD_DATA_SIZE, Chr(0)) ' pre-allocate memory
iRet = LceGetFieldDesc(iSession, "SKILCODE", sBuff)
'--------------------------------------------------
status2 = sTrim(sBuff)
Read and set the maximum length for fields SKILCODE and SKILDESC.
Dim length as integer, decimals as integer
'Set skill code field length
sBuff = String(FIELD_DATA_SIZE, Chr(0))
iRet = LceGetFieldType(iSession, "SKILCODE", sBuff, _
length, decimals)
txtCode.MaxLength = length
'------------------------------------------------------
'Set skill description field length
sBuff = String(FIELD_DATA_SIZE, Chr(0))
iRet = LceGetFieldType(iSession, "SKILDESC", sBuff, _
length, decimals)
txtDesc.MaxLength = length