project BLF > class BReportVariant > method SetReportCBF

Description

Create or update a dummy report variant for QRF reports to store custom field information only.


Parameters


iiBusActivityIDinputinteger
tRptReportCBFinputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BResource.SetReportCBF


program code (program1/breportvariant.p)

vcDLQuery = "for each RptRequest where RptRequest.RptRequestType = 'V'"
          + " and RptRequest.RptRequestName = '" + {&STOREDSEARCH-CUSTOMER-DEFAULT}
          + "' and RptRequest.BusActivity_ID = " + string (iiBusActivityID).
<M-96 run DataLoad
   (input  '' (icRowids), 
    input  '' (icPkeys), 
    input  '' (icObjectIds), 
    input  vcDLQuery (icFreeform), 
    input  no (ilKeepPrevious), 
    output viFcReturnSuper (oiReturnStatus)) in BReportVariant>
if viFcReturnSuper = -4
then do:
    <M-73 run DataNew  (output viFcReturnSuper (oiReturnStatus)) in BReportVariant>
    if viFcReturnSuper >= 0
    then assign tRptRequest.BusActivity_ID          = iiBusActivityID
                tRptRequest.tcBusComponentCode      = ?
                tRptRequest.tcBusActivityCode       = ?
                tRptRequest.RptRequestName          = {&STOREDSEARCH-CUSTOMER-DEFAULT}
                tRptRequest.RptRequestType          = "V"
                tRptRequest.RptRequestDateFormat    = ""
                tRptRequest.RptRequestDateSeparator = ""
                tRptRequest.RptRequestTimeFormat    = "hms"
                tRptRequest.RptRequestTimeSeparator = ":"
                tRptRequest.RptRequestDecimalPoint  = "".
end.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

for each tRptRequestCBF:
    tRptRequestCBF.tc_Status = "D".
end.

for each tRptReportCBF where tRptReportCBF.tcReportCBFResultsetField <> "" on error undo, throw:
    find first tRptRequestCBF where tRptRequestCBF.RptRequestCBF = tRptReportCBF.tcReportCBFCustomFieldName no-error.
    if available tRptRequestCBF
    then assign tRptRequestCBF.RptRequestResultField = tRptReportCBF.tcReportCBFResultsetField
                tRptRequestCBF.tc_Status = "C".
    else do:
        <M-31 run AddDetailLine
           (input  'RptRequestCBF' (icTable), 
            input  tRptRequest.tc_Rowid (icParentRowid), 
            output viFcReturnSuper (oiReturnStatus)) in BReportVariant>
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.
        assign tRptRequestCBF.RptRequestResultField = tRptReportCBF.tcReportCBFResultsetField
               tRptRequestCBF.RptRequestCBF = tRptReportCBF.tcReportCBFCustomFieldName
               tRptRequestCBF.RptRequest_ID = tRptRequest.RptRequest_ID.
    end.
end.

<M-56 run ValidateBC  (output viFcReturnSuper (oiReturnStatus)) in BReportVariant>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

<M-22 run AdditionalUpdates  (output viFcReturnSuper (oiReturnStatus)) in BReportVariant>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

<M-94 run DataSave  (output viFcReturnSuper (oiReturnStatus)) in BReportVariant>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.