project QadFinancials > class BCDocumentReport > method GetBusinessFields

Description

This method is used to set filters for reports on the UI.


Parameters


icReferenceinputcharacter- <classname> for receiving business field information of a business class
- <classname>.<methodname> for receiving business field information of a browse or report
tBusinessFieldsoutputtemp-table
tCustomRelationoutputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program/bcdocumentreport.p)

<ANCESTOR-CODE>
/* two fields only for CDocumentReportCheque */
if can-do("CDocumentReportCheque,CDocumentReportDraft":U, icReference)
then do:     
    /* BankPayFormat */
    /* create tBusinessFields. */

    /* This initial value is only for display usage, to replace the default 'ALL' */
    /* assign vcValueList = '':U.

    if icReference = "CDocumentReportCheque"
    then do:
        <Q-113 run BankPayFormatByModuleInstrument (all) (Read) (NoCache)
           (input viCompanyId, (CompanyId)
            input {&PAYFORMATMODULE-AP}, (PayFormatTypeModule)
            input {&PAYFORMATPAYINSTRUMENT-CHEQUE}, (PayFormatTypePayInstrument)
            output dataset tqBankPayFormatByModuleInst) in BBankPayFormat >
    end.
    else if icReference = "CDocumentReportDraft"
    then do:
        <Q-114 run BankPayFormatByModuleInstrument (all) (Read) (NoCache)
           (input viCompanyId, (CompanyId)
            input {&PAYFORMATMODULE-AP}, (PayFormatTypeModule)
            input {&PAYFORMATPAYINSTRUMENT-DRAFT}, (PayFormatTypePayInstrument)
            output dataset tqBankPayFormatByModuleInst) in BBankPayFormat >
    end. */ /* if icReference = "CDocumentReportCheque" */

    /* for each tqBankPayFormatByModuleInst:    
        vcValueList = vcValueList + 
                      tqBankPayFormatByModuleInst.tcBankNumber + 
                      " " + tqBankPayFormatByModuleInst.tcPayFormatTypeCode + " #" +
                      string(tqBankPayFormatByModuleInst.tiBankPayFormatNextCheckNbr) + chr(2) +
                      string(tqBankPayFormatByModuleInst.tiBankPayFormat_ID) + chr(2).
    end. */ /* end of for each */ 
    
    /* vcValueList = trim(vcValueList, chr(2)).     
    assign tBusinessFields.tcFcDescription     = trim(#T-103'Bank Payment Format':100(65754)T-103#)
           tBusinessFields.tcSideLabel         = trim(#T-104'Bank Payment Format':100(65754)T-104#)
           tBusinessFields.tcFcFieldName       = "BankPayFormatID":U   
           tBusinessFields.tcDataType          = "c":U
           tBusinessFields.tcControlType       = "TextBox":U
           tBusinessFields.tcDisplayFormat     = "x(20)":U
           tBusinessFields.tcFcFieldType       = "F":U
           tBusinessFields.tcLookupQuery       = "BBankPayFormatSAO.SelectBankPayFormatForAPCheck":U
           tBusinessFields.tcLookupReturnField = "tqSelectBankPayFormatForAPCheck.tcLngCode":U
           tBusinessFields.tcLookupFilterField = "tLng.LngCode":U. */

    if icReference = "CDocumentReportCheque"
    then do:
        create tBusinessFields.
        assign tBusinessFields.tcFcDescription = trim(#T-119'Bank Payment Format':100(65754)T-119#)
               tBusinessFields.tcSideLabel     = trim(#T-123'Bank Payment Format':100(65754)T-123#)
               tBusinessFields.tcFcFieldName   = "BankPayFormatID":U
               tBusinessFields.tcDataType      = "c":U
               tBusinessFields.tcControlType   = "TextBox":U
               tBusinessFields.tcDisplayFormat = "x(20)":U
               tBusinessFields.tcFcFieldType   = "F":U
               tBusinessFields.tcLookupQuery       = "BBankPayFormatSAO.SelectBankPayFormatForAPCheck":U
               tBusinessFields.tcLookupReturnField = "tqSelectBankPayFormatForAPCheck.tcBankPaymentFormat":U
               tBusinessFields.tcLookupFilterField = "tBankPayFormat.BankPayFormat_ID":U.
    end.
    else if icReference = "CDocumentReportDraft"
    then do:
        create tBusinessFields.
        assign tBusinessFields.tcFcDescription = trim(#T-121'Bank Payment Format':100(65754)T-121#)
               tBusinessFields.tcSideLabel     = trim(#T-122'Bank Payment Format':100(65754)T-122#)
               tBusinessFields.tcFcFieldName   = "BankPayFormatID":U
               tBusinessFields.tcDataType      = "c":U
               tBusinessFields.tcControlType   = "TextBox":U
               tBusinessFields.tcDisplayFormat = "x(20)":U
               tBusinessFields.tcFcFieldType   = "F":U
               tBusinessFields.tcLookupQuery       = "BBankPayFormatSAO.SelectBankPayFormatForAPDraft":U
               tBusinessFields.tcLookupReturnField = "tqSelectBankPayFormatForAPDraft.tcBankPaymentFormat":U
               tBusinessFields.tcLookupFilterField = "tBankPayFormat.BankPayFormat_ID":U.
    end.

    /* PrintType */
    create tBusinessFields.
    
    assign tBusinessFields.tcFcDescription = trim(#T-105'Print Type':11(65750)T-105#)
           tBusinessFields.tcSideLabel     = trim(#T-106'Print Type':11(65760)T-106#)
           tBusinessFields.tcValueList     = {&PRINTTYPES}
           tBusinessFields.tcControlType   = "ComboBoxM":U
           tBusinessFields.tcDataType      = "c":U
           tBusinessFields.tcDisplayFormat = "x(20)":U
           tBusinessFields.tcFcFieldName   = "PrintType":U
           tBusinessFields.tcFcFieldType   = "F":U.

    if icReference = "CDocumentReportCheque"
    then do:
        create tBusinessFields.
        assign tBusinessFields.tcFcDescription = trim(#T-115'Sort by':20(17526)T-115#)
               tBusinessFields.tcSideLabel     = trim(#T-116'Sort by':20(17526)T-116#)
               /* tBusinessFields.tcValueList     = {&CDOCUMENT-SORTBY} */
               tBusinessFields.tcValueList     = {&CDOCUMENT-SORTBY-CREDITORNAME-TR} + chr(2) + {&CDOCUMENT-SORTBY-CREDITORNAME} + chr(2) + {&CDOCUMENT-SORTBY-CREDITORCODE-TR} + chr(2) + {&CDOCUMENT-SORTBY-CREDITORCODE}               tBusinessFields.tcControlType   = "ComboBoxM":U
               tBusinessFields.tcDataType      = "c":U
               tBusinessFields.tcDisplayFormat = "x(20)":U
               tBusinessFields.tcFcFieldName   = "Sortby":U
               tBusinessFields.tcFcFieldType   = "F":U.

        create tBusinessFields.

        assign tBusinessFields.tcFcDescription = trim(#T-117'Supplier Business Relation Name':40(71236)T-117#)
               tBusinessFields.tcSideLabel     = trim(#T-118'From - To Supplier Business Relation Name':100(71237)T-118#)
               tBusinessFields.tcControlType   = "TextBox":U
               tBusinessFields.tcDataType      = "c":U
               tBusinessFields.tcDisplayFormat = "x(20)":U
               tBusinessFields.tcFcFieldName   = "CreditorBRName_RANGE":U
               tBusinessFields.tcFcFieldType   = "F":U
               tBusinessFields.tcLookupQuery       = "BBusinessRelationSAO.SelectBusinessRelation":U
               tBusinessFields.tcLookupReturnField = "tqSelectBusinessRelation.tcBusinessRelationName1":U
               tBusinessFields.tcLookupFilterField = "tBusinessRelation.BusinessRelationName1":U.
    end.
end. 
else do:    
    /* Assign CDocumentPrePrintedNumber */
    create tBusinessFields.
    
    assign tBusinessFields.tcFcDescription = trim(#T-111'Assign Preprinted Number':200(14000)T-111#)
           tBusinessFields.tcSideLabel     = trim(#T-112'Assign Preprinted Number':50(13999)T-112#)
           tBusinessFields.tcControlType   = "Bool":U
           tBusinessFields.tcDataType      = "l":U
           tBusinessFields.tcDisplayFormat = "yes/no":U
           tBusinessFields.tcFcFieldName   = "AssignCDocumentPrePrintedNumber":U
           tBusinessFields.tcFcFieldType   = "F":U.    
    
    /* Increase CDocumentTimesPrinted */       
    create tBusinessFields.
    
    assign tBusinessFields.tcFcDescription = trim(#T-101'Increase Print counter':100(65743)T-101#)
           tBusinessFields.tcSideLabel     = trim(#T-102'Increase counter':30(65744)T-102#)
           tBusinessFields.tcControlType   = "Bool":U
           tBusinessFields.tcDataType      = "l":U
           tBusinessFields.tcDisplayFormat = "yes/no":U
           tBusinessFields.tcFcFieldName   = "IncreaseCDocumentTimesPrinted":U
           tBusinessFields.tcFcFieldType   = "F":U.

    /* CDocumentTimesPrinted */
    create tBusinessFields.
    
    assign tBusinessFields.tcFcDescription = trim(#T-97'Only new Payments':100(65745)T-97#)
           tBusinessFields.tcSideLabel     = trim(#T-98'Only new Payments':30(65746)T-98#)
           tBusinessFields.tcControlType   = "Bool":U
           tBusinessFields.tcDataType      = "l":U
           tBusinessFields.tcDisplayFormat = "yes/no":U
           tBusinessFields.tcFcFieldName   = "CDocumentTimesPrinted":U
           tBusinessFields.tcFcFieldType   = "F":U.
end. /* end of if not can-do("CDocumentReportCheque":U, icReference) */

/* CCollectionNumber */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-76'Selection Number':100(950)T-76#)
       tBusinessFields.tcSideLabel     = trim(#T-77'Selection Number':20(949)T-77#)
       tBusinessFields.tcControlType   = "NumericInt":U
       tBusinessFields.tcDataType      = "i":U
       tBusinessFields.tcDisplayFormat = ">>>>>>>>9":U
       tBusinessFields.tcFcFieldName   = "CCollectionNumber":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* CDocumentCreationDate */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-67'Creation Date':100(873)T-67#)
       tBusinessFields.tcSideLabel     = trim(#T-65'Creation Date':20(14013)T-65#)
       tBusinessFields.tcControlType   = "DateTime":U
       tBusinessFields.tcDataType      = "t":U
       tBusinessFields.tcDisplayFormat = "99/99/9999":U
       tBusinessFields.tcFcFieldName   = "CDocumentCreationDate_RANGE":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* CDocumentDueDate */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-61'Due Date':100(948)T-61#)
       tBusinessFields.tcSideLabel     = trim(#T-59'Due Date':20(947)T-59#)
       tBusinessFields.tcControlType   = "DateTime":U
       tBusinessFields.tcDataType      = "t":U
       tBusinessFields.tcDisplayFormat = "99/99/9999":U
       tBusinessFields.tcFcFieldName   = "CDocumentDueDate_RANGE":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* CDocumentIsOpen */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-58'Open':100(946)T-58#)
       tBusinessFields.tcSideLabel     = trim(#T-56'Open':30(945)T-56#)
       tBusinessFields.tcControlType   = "Bool":U
       tBusinessFields.tcDataType      = "l":U
       tBusinessFields.tcDisplayFormat = "yes/no":U
       tBusinessFields.tcFcFieldName   = "CDocumentIsOpen":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* CDocumentNumber */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-51'From - To Document Number':100(14033)T-51#)
       tBusinessFields.tcSideLabel     = trim(#T-52'Document Number':20(5410)T-52#)
       tBusinessFields.tcControlType   = "NumericInt":U
       tBusinessFields.tcDataType      = "i":U
       tBusinessFields.tcDisplayFormat = ">>>>>>>>9":U
       tBusinessFields.tcFcFieldName   = "CDocumentNumber_RANGE":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* CDocumentPrePrintedNumber */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-107'From - To Preprinted Number':200(13944)T-107#)
       tBusinessFields.tcSideLabel     = trim(#T-108'Preprinted Number':25(13943)T-108#)
       tBusinessFields.tcControlType   = "NumericInt":U
       tBusinessFields.tcDataType      = "i":U
       tBusinessFields.tcDisplayFormat = "9999":U
       tBusinessFields.tcFcFieldName   = "CDocumentPrePrintedNumber_RANGE":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* CDocumentReference */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-55'Document Reference':100(14034)T-55#)
       tBusinessFields.tcSideLabel     = trim(#T-53'Document Reference':25(14035)T-53#)
       tBusinessFields.tcControlType   = "TextBox":U
       tBusinessFields.tcDataType      = "c":U
       tBusinessFields.tcDisplayFormat = "x(20)":U
       tBusinessFields.tcFcFieldName   = "CDocumentReference":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* CDocumentStatus */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-64'Status':100(940)T-64#)
       tBusinessFields.tcSideLabel     = trim(#T-62'Status':8(939)T-62#)
       tBusinessFields.tcValueList     = {&DOCUMENTSTATUSCREDITORSRPT}
       tBusinessFields.tcControlType   = "ComboBox":U
       tBusinessFields.tcDataType      = "c":U
       tBusinessFields.tcDisplayFormat = "x(20)":U
       tBusinessFields.tcFcFieldName   = "CDocumentStatus":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* CDocumentSubType */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-48'Subtype':11(14031)T-48#)
       tBusinessFields.tcSideLabel     = trim(#T-46'Subtype':11(14031)T-46#)
       tBusinessFields.tcValueList     = {&DOCUMENTSUBTYPES}
       tBusinessFields.tcControlType   = "ComboBox":U
       tBusinessFields.tcDataType      = "c":U
       tBusinessFields.tcDisplayFormat = "x(20)":U
       tBusinessFields.tcFcFieldName   = "CDocumentSubType":U
       tBusinessFields.tcFcFieldType   = "F":U.


/* CDocumentYear */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-49'Document Year':20(14032)T-49#)
       tBusinessFields.tcSideLabel     = trim(#T-1'Document Year':20(14032)T-1#)
       tBusinessFields.tcControlType   = "NumericInt":U
       tBusinessFields.tcDataType      = "i":U
       tBusinessFields.tcDisplayFormat = "9999":U
       tBusinessFields.tcFcFieldName   = "CDocumentYear":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* CreditorCode */
create tBusinessFields.

assign tBusinessFields.tcFcDescription     = trim(#T-8'Supplier Code':100(1935)T-8#)
       tBusinessFields.tcSideLabel         = trim(#T-74'Supplier Code':30(1553)T-74#)
       tBusinessFields.tcControlType       = "TextBox":U
       tBusinessFields.tcDataType          = "c":U
       tBusinessFields.tcDisplayFormat     = "x(20)":U
       tBusinessFields.tcFcFieldName       = "CreditorCode":U
       tBusinessFields.tcFcFieldType       = "F":U
       tBusinessFields.tcLookupFilterField = "tCreditor.CreditorCode":U
       tBusinessFields.tcLookupQuery       = "BCreditorSAO.SelectCreditor":U
       tBusinessFields.tcLookupReturnField = "tqSelectCreditor.tcCreditorCode":U.

/* CurrencyCode */
create tBusinessFields.

assign tBusinessFields.tcFcDescription     = trim(#T-20'Currency Code':100(771)t-20#)
       tBusinessFields.tcSideLabel         = trim(#T-79'Currency':8(770)T-79#)
       tBusinessFields.tcControlType       = "TextBox":U
       tBusinessFields.tcDataType          = "c":U
       tBusinessFields.tcDisplayFormat     = "x(20)":U
       tBusinessFields.tcFcFieldName       = "CurrencyCode":U
       tBusinessFields.tcFcFieldType       = "F":U
       tBusinessFields.tcLookupFilterField = "tCurrency.CurrencyCode":U
       tBusinessFields.tcLookupQuery       = "BCurrencySAO.SelectCurrency":U
       tBusinessFields.tcLookupReturnField = "tqSelectCurrency.tcCurrencyCode":U.

/* PaySelCode */
create tBusinessFields.

assign tBusinessFields.tcFcDescription     = trim(#T-81'Payment Selection':100(881)T-81#)
       tBusinessFields.tcSideLabel         = trim(#T-82'Payment Selection':30(880)T-82#)
       tBusinessFields.tcControlType       = "TextBox":U
       tBusinessFields.tcDataType          = "c":U
       tBusinessFields.tcDisplayFormat     = "x(20)":U
       tBusinessFields.tcFcFieldName       = "PaySelCode":U
       tBusinessFields.tcFcFieldType       = "F":U
       tBusinessFields.tcLookupFilterField = "tPaySel.PaySelCode":U
       tBusinessFields.tcLookupQuery       = "BPaymentSelectionSAO.SelectPaySelForReport":U
       tBusinessFields.tcLookupReturnField = "tqSelectPaySelForReport.tcPaySelCode":U.

/* Start From CDocumentPrePrintedNumber */
/* create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-36'Start from number':200(13901)T-36#)
       tBusinessFields.tcSideLabel     = trim(#T-85'Start from number':30(13900)T-85#)
       tBusinessFields.tcControlType   = "NumericInt":U
       tBusinessFields.tcDataType      = "i":U
       tBusinessFields.tcDisplayFormat = "9999":U
       tBusinessFields.tcFcFieldName   = "StartFromCDocumentPrePrintedNumber":U
       tBusinessFields.tcFcFieldType   = "F":U.

/* Skip CDocumentPrePrintedNumber */
create tBusinessFields.

assign tBusinessFields.tcFcDescription = trim(#T-40'Skip numbers when more than X invoices':200(13903)T-40#)
       tBusinessFields.tcSideLabel     = trim(#T-86'Skip numbers when more than X invoices':100(13902)T-86#)
       tBusinessFields.tcControlType   = "NumericInt":U
       tBusinessFields.tcDataType      = "i":U
       tBusinessFields.tcDisplayFormat = "9999":U
       tBusinessFields.tcFcFieldName   = "SkipCDocumentPrePrintedNumber":U
       tBusinessFields.tcFcFieldType   = "F":U. */


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 = "BCDocumentReport".
create ttContext.
assign ttContext.propertyName = "methodName"
       ttContext.propertyValue = "GetBusinessFields".
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.