Description
Load a set of fixed predefined report codes.
These codes are defined hard-coded in class TReportStrings.
Parameters
| olUpdatesDone | output | logical | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program9/breporttranslation.p)
/* ================================================================= */
/* Load all existing strings (including user-defined) */
/* ================================================================= */
<M-5 run DataLoad
(input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input '' (icFreeform),
input no (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BReportTranslation>
if viFcReturnSuper = -4 then viFcReturnSuper = 0. /* no error when nothing found */
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
for each tReportTranslation where tReportTranslation.ReportTranslationIsSysDef:
tReportTranslation.tc_Status = "D".
end.
/* ================================================================= */
/* Load fixed data */
/* ================================================================= */
<Q-17 run LanguageByCodeID (all) (Read) (NoCache)
(input ?, (LngCode)
input ?, (LngID)
input true, (Installed)
output dataset tqLanguageByCodeID) in BLanguage >
vcLanguages = "?":U.
for each tqLanguageByCodeID on error undo, throw:
vcLanguages = vcLanguages + ",":U + tqLanguageByCodeID.tcLngCode.
end.
empty temp-table tFixedData.
assign vcCurrentLanguage = current-language.
do viCount1 = 1 to num-entries(vcLanguages):
current-language = entry (viCount1,vcLanguages).
<M-16 run Main
(output tFixedData append (tReportStrings),
input {&TARGETPROCEDURE} (ihTranslationHandle)) in TReportStrings>
run gipr_DeleteProcedure in vhFcComponent.
delete procedure vhFcComponent.
for each tFixedData where not tFixedData.tcStringCode begins "Lng,":U on error undo, throw:
assign tFixedData.tcStringCode = "Lng,":U + entry (viCount1,vcLanguages) + ",":U + tFixedData.tcStringCode
tFixedData.tcStringText = trim (tFixedData.tcStringText).
end.
end.
current-language = vcCurrentLanguage.
/* ================================================================= */
/* Lookup activity fixed data ( = report names ) */
/* ================================================================= */
<Q-4 run BusActivityByActCompDefault (all) (Read) (NoCache)
(input '', (BusActitvityCode)
input '', (BusComponentCode)
input ?, (BusActiivtyIsDefault)
input ?, (BusActivytIsActive)
output dataset tqBusActivityByActCompDefault) in BBusinessComponent >
/* ================================================================= */
/* Updates */
/* ================================================================= */
for each tFixedData where tFixedData.tcStringCode begins "Lng,?,":U on error undo, throw:
if tFixedData.tcClassName = ""
then do:
<M-11 run apiSynchroniseUpdateTranslation
(input 0 (iiClassId),
input 0 (iiReportId),
input entry (3,tFixedData.tcStringCode) (icStringCode),
input tFixedData.tcStringText (icStringText),
input tFixedData.tcClassName (icClassName),
input tFixedData.tcReportName (icReportName),
input tFixedData.tcClassName (icFixedDataClassName),
input tFixedData.tcReportName (icFixedDataReportName),
output vlFcOk (olUpdatesDone),
output viFcReturnSuper (oiReturnStatus)) in BReportTranslation>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
if vlFcOk
then assign olUpdatesDone = yes.
end.
else do viCount1 = 1 to num-entries(tFixedData.tcClassName):
if tFixedData.tcReportName = ""
then do:
find first tqBusActivityByActCompDefault where
tqBusActivityByActCompDefault.tcBusComponentCode = entry(viCount1,tFixedData.tcClassName)
no-error.
if not available tqBusActivityByActCompDefault
then do:
Next.
end.
<M-14 run apiSynchroniseUpdateTranslation
(input tqBusActivityByActCompDefault.tiBusComponent_ID (iiClassId),
input 0 (iiReportId),
input entry (3,tFixedData.tcStringCode) (icStringCode),
input tFixedData.tcStringText (icStringText),
input tqBusActivityByActCompDefault.tcBusComponentCode (icClassName),
input '' (icReportName),
input tFixedData.tcClassName (icFixedDataClassName),
input '' (icFixedDataReportName),
output vlFcOk (olUpdatesDone),
output viFcReturnSuper (oiReturnStatus)) in BReportTranslation>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
if vlFcOk
then assign olUpdatesDone = yes.
end.
else do viCount2 = 1 to num-entries(tFixedData.tcReportName):
find first tqBusActivityByActCompDefault where
tqBusActivityByActCompDefault.tcBusComponentCode = entry(viCount1,tFixedData.tcClassName) and
tqBusActivityByActCompDefault.tcBusActivityCode = entry(viCount2,tFixedData.tcReportName)
no-error.
if not available tqBusActivityByActCompDefault
then do:
Next.
end.
<M-12 run apiSynchroniseUpdateTranslation
(input tqBusActivityByActCompDefault.tiBusComponent_ID (iiClassId),
input tqBusActivityByActCompDefault.tiBusActivity_ID (iiReportId),
input entry (3,tFixedData.tcStringCode) (icStringCode),
input tFixedData.tcStringText (icStringText),
input tqBusActivityByActCompDefault.tcBusComponentCode (icClassName),
input tqBusActivityByActCompDefault.tcBusActivityCode (icReportName),
input tFixedData.tcClassName (icFixedDataClassName),
input tFixedData.tcReportName (icFixedDataReportName),
output vlFcOk (olUpdatesDone),
output viFcReturnSuper (oiReturnStatus)) in BReportTranslation>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
if vlFcOk
then assign olUpdatesDone = yes.
end.
end.
end.
empty temp-table tqBusActivityByActCompDefault.
<M-89 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BReportTranslation>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-76 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BReportTranslation>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-10 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BReportTranslation>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
Sample code: how to call this method through RPCRequestService (QXtend Inbound)
define temp-table ttContext no-undo
field propertyQualifier as character
field propertyName as character
field propertyValue as character
index entityContext is primary unique
propertyQualifier
propertyName
index propertyQualifier
propertyQualifier.
define dataset dsContext for ttContext.
define variable vhContextDS as handle no-undo.
define variable vhExceptionDS as handle no-undo.
define variable vhServer as handle no-undo.
define variable vhInputDS as handle no-undo.
define variable vhInputOutputDS as handle no-undo.
define variable vhOutputDS as handle no-undo.
define variable vhParameter as handle no-undo.
/* Create context */
create ttContext.
assign ttContext.propertyName = "programName"
ttContext.propertyValue = "BReportTranslation".
create ttContext.
assign ttContext.propertyName = "methodName"
ttContext.propertyValue = "apiSynchronise".
create ttContext.
assign ttContext.propertyName = "applicationId"
ttContext.propertyValue = "fin".
create ttContext.
assign ttContext.propertyName = "entity"
ttContext.propertyValue = "1000".
create ttContext.
assign ttContext.propertyName = "userName"
ttContext.propertyValue = "mfg".
create ttContext.
assign ttContext.propertyName = "password"
ttContext.propertyValue = "".
/* Connect the AppServer */
create server vhServer.
vhServer:connect("-URL <appserver-url>").
if not vhServer:connected()
then do:
message "Could not connect AppServer" view-as alert-box error title "Error".
return.
end.
/* Run */
assign vhContextDS = dataset dsContext:handle.
run program/rpcrequestservice.p on vhServer
(input-output dataset-handle vhContextDS by-reference,
output dataset-handle vhExceptionDS,
input dataset-handle vhInputDS by-reference,
input-output dataset-handle vhInputOutputDS by-reference,
output dataset-handle vhOutputDS).
/* Handle output however you want, in this example, we dump it to xml */
if valid-handle(vhExceptionDS)
then vhExceptionDS:write-xml("file", "Exceptions.xml", true).
if valid-handle(vhOutputDS)
then vhOutputDS:write-xml("file", "Output.xml", true).
/* Cleanup */
vhServer:disconnect().
assign vhServer = ?.
if valid-handle(vhInputDS)
then delete object vhInputDS.
if valid-handle(vhOutputDS)
then delete object vhOutputDS.
if valid-handle(vhExceptionDS)
then delete object vhExceptionDS.