16 2 1 Field types and Language specific data

LANSA Application Design

16.2.1 Field types and Language-specific data

  • For short fields that will be a code in uppercase, continue to use Alpha or Char. For example, ISOCountryCode Alpha(2) can hold the ISO country codes like AU, CA, DE, FR, GB, JP, US.
  • For code descriptions, use an Nchar or Nvarchar. For example, CountryDescription Nvarchar(20). If you wish to have language-specific descriptions, store the language with the data when it is entered. This would allow the description to be retrieved by language. For example, create a file called Countries, which has a two-part Primary Key ISOCountryCode, Language. This would allow the appropriate description to be returned for the language I am running in. The following code would set #CountryDescription appropriately for the language, so if LANG=ENG "Germany", if LANG=DEU "Deutschland", if LANG=FRA "Allemagne" and so on.

#ISOCountryCode := DE

Fetch Fields(#CountryDescription) From_File(Countries) WITH_KEY(#ISOCountryCode *LANGUAGE)

  • For data that may contain unusual characters, use an Nchar or Nvarchar. For example, universities need to print a student's name correctly on certificates, so they might create EnglishName String(50) and ExactStudentName Nvarchar(50). This would allow a file like the following:

Also See

16.1.1 Unicode Field Types

Field Type Considerations in the Technical Reference Guide

Ý 16.2 Developing New Applications with Unicode