project BLF > class BTranslation > method DataLoadByParent
Description
Load all translations of a list of business objects. And initialize active languages without translation.
Parameters
ipParentObjectIds | input | longchar | Comma separated list of object identity values. |
icDefaultTranslation | input | character | Default for when no translation is found. |
tTransString | output | temp-table | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/btranslation.p)
/* ================================================================= */
/* Load the data into the class tables. */
/* ================================================================= */
empty temp-table tTransString.
viObjectTotal = num-entries (ipParentObjectIds).
do viObjectCount = 1 to viObjectTotal:
if vcFreeform = ""
then vcFreeform = "for each TranslationString where TranslationString.ParentObject_ID = "
+ entry(viObjectCount,ipParentObjectIds).
else vcFreeform = vcFreeform + " or TranslationString.ParentObject_ID = "
+ entry(viObjectCount,ipParentObjectIds).
if viObjectCount = viObjectTotal
or (viObjectCount mod 100) = 0
then do:
<M-53 run DataLoad
(input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcFreeform (icFreeform),
input yes (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BTranslation>
if viFcReturnSuper = -4
then viFcReturnSuper = 0.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
vcFreeform = "".
end.
end.
/* ================================================================= */
/* Prepare the data to return */
/* (including all languages that do not have a translation). */
/* ================================================================= */
<Q-93 run LanguageByCodeID (all) (Read) (NoCache)
(input '', (LngCode)
input 0, (LngID)
input ?, (Installed)
output dataset tqLanguageByCodeID) in BLanguage >
do viObjectCount = 1 to viObjectTotal:
for each tqLanguageByCodeID where tqLanguageByCodeID.tlLngIsActive on error undo, throw:
viObjectID = integer (entry(viObjectCount,ipParentObjectIds)).
find first tTranslationString where
tTranslationString.ParentObject_ID = viObjectID and
tTranslationString.Lng_ID = tqLanguageByCodeID.tiLng_ID
no-error.
create tTransString.
assign tTransString.tiParentObject_ID = viObjectID
tTransString.tcLngCode = tqLanguageByCodeID.tcLngCode
tTransString.tcTranslationStringText = (if available tTranslationString
then tTranslationString.TranslationStringText
else icDefaultTranslation)
tTransString.tc_ParentRowid = ""
tTransString.tc_Rowid = (if available tTranslationString
then tTranslationString.tc_Rowid
else tqLanguageByCodeID.tcLngCode + entry(viObjectCount,ipParentObjectIds))
tTransString.tc_Status = (if available tTranslationString then "" else "N").
release tTransString.
end.
end.