project BLF > class ComponentPool > method GetTranslationForObject

Description

Lookup the actual translation of a translatable business field for one specific business object.


Parameters


iiObjectIDinputintegerid
icLanguageCodeinputcharacterLanguage
icOriginalinputcharacteroriginal text
icFieldNameinputcharacterSpecify the field name, in case TranslationStringText contains more than one field.
ocTranslationoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method database.GetBusinessFields
method breport.GetBusinessFields
method query.GetBusinessFields

QadFinancials
method BBudgetReporting.BudgetDetail
method BBudgetReporting.BudgetOverview
method BGLReport.GLList
method BGLReport.GLMasterCard
method Session.GetBusinessFieldsExtended


program code (program1/componentpool.p)

/* ======================================================= */
/* Default the translation with the original/native string */
/* ======================================================= */
assign ocTranslation = icOriginal.

/* ======================================================= */
/* Return in case the required info is missing             */
/* ======================================================= */
if icLanguageCode = "":U or
   icLanguageCode = ?    or
   iiObjectID = 0        or
   iiObjectID = ?
then return.

/* ============================================================================================================ */
/* Componentpool cannot contain database access as it will be run before the application database is connected. */
/* Delegate the database access to the cacher class.                                                            */
/* Ensure we return the original in case there was no translation found (ocTranslation is empty)                */
/* ============================================================================================================ */ 
<M-50 run StartCacherInPool  (output vhFcComponent (ohCacher)) in ComponentPool>
<M-32 run GetTranslationForObject
   (input  icLanguageCode (icLanguageCode), 
    input  iiObjectID (iiParentObject_ID), 
    input  icFieldName (icFieldName), 
    output ocTranslation (ocTranslation), 
    output oiReturnStatus (oiReturnStatus)) in Cacher>
if ocTranslation = "":U or 
   ocTranslation = ?
then assign ocTranslation = icOriginal.