project QadFinancials > class BDDocument > API query SelectDDocument (optimised)

Description

Select query for DDocument


query filter (table tFilter)


tcBusinessFieldNametcDataTypetcOperator
iiCompanyIdi
tBankNumber.BankNumberc=,>=,>,<>,<=,<,begins,can-do,matches
tBusinessRelation.BusinessRelationCodec=,>=,>,<>,<=,<,begins,can-do,matches
tBusinessRelation.BusinessRelationName1c=,>=,>,<>,<=,<,begins,can-do,matches
tBusinessRelation.BusinessRelationSearchNamec=,>=,>,<>,<=,<,begins,can-do,matches
tCorporateGroup.CorporateGroupCodec=,>=,>,<>,<=,<,begins,can-do,matches
tCurrency.CurrencyCodec=,>=,>,<>,<=,<,begins,can-do,matches
tDDocument.DDocumentBankImpRefc=,>=,>,<>,<=,<,begins,can-do,matches
tDDocument.DDocumentCreationDatet=,>=,>,<>,<=,<
tDDocument.DDocumentCreationTimei=,>=,>,<>,<=,<
tDDocument.DDocumentDueDatet=,>=,>,<>,<=,<
tDDocument.DDocumentIncassoSelectCodec=,>=,>,<>,<=,<,begins,can-do,matches
tDDocument.DDocumentIsOpenl=,<>
tDDocument.DDocumentLastPrintDatet=,>=,>,<>,<=,<
tDDocument.DDocumentNumberi=,>=,>,<>,<=,<
tDDocument.DDocumentOriginalDebitCCd=,>=,>,<>,<=,<
tDDocument.DDocumentOriginalDebitLCd=,>=,>,<>,<=,<
tDDocument.DDocumentOriginalDebitTCd=,>=,>,<>,<=,<
tDDocument.DDocumentReferencec=,>=,>,<>,<=,<,begins,can-do,matches
tDDocument.DDocumentStatusc=,>=,>,<>,<=,<,begins,can-do,matches
tDDocument.DDocumentSubTypec=,>=,>,<>,<=,<,begins,can-do,matches
tDDocument.DDocumentTimesPrintedi=,>=,>,<>,<=,<
tDDocument.DDocumentTypec=,>=,>,<>,<=,<,begins,can-do,matches
tDDocument.DDocumentValueDaysi=,>=,>,<>,<=,<
tDDocument.DDocumentYeari=,>=,>,<>,<=,<
tDebtor.DebtorCodec=,>=,>,<>,<=,<,begins,can-do,matches
tDPaySel.DPaySelCodec=,>=,>,<>,<=,<,begins,can-do,matches
tGL.GLCodec=,>=,>,<>,<=,<,begins,can-do,matches
tPayFormatType.PayFormatTypeCodec=,>=,>,<>,<=,<,begins,can-do,matches
tUsr.UsrNamec=,>=,>,<>,<=,<,begins,can-do,matches


Parameters (internal)


iiCompanyIdintegerCompany id


query condition


  each DDocument where
DDocument.Company_Id = iiCompanyId AND

      first BankNumber (inner-join) where
BankNumber.BankNumber_ID = DDocument.BankNumber_ID AND

          first BankPayFormat (inner-join) where
BankPayFormat.BankPayFormat_ID = BankNumber.BankPayFormat_ID AND

              first PayFormatType (inner-join) where
PayFormatType.PayFormatTypeCode = BankPayFormat.PayFormatTypeCode AND

      first Currency (inner-join) where
Currency.Currency_ID = DDocument.Currency_ID AND

      first Debtor (inner-join) where
Debtor.SharedSet_Id = vi_DEBTOR_sharedset(iiCompanyId) AND
Debtor.Debtor_ID = DDocument.Debtor_ID AND

          first BusinessRelation (inner-join) where
BusinessRelation.BusinessRelation_ID = Debtor.BusinessRelation_ID AND

              first CorporateGroup (conditional-join) where
CorporateGroup.CorporateGroup_ID = BusinessRelation.CorporateGroup_ID AND

      first DPaySel (conditional-join) where
DPaySel.Company_Id = iiCompanyId AND
DPaySel.DPaySel_ID = DDocument.DPaySel_ID AND

      first GL (inner-join) where
GL.SharedSet_Id = vi_GL_sharedset(iiCompanyId) AND
GL.GL_ID = DDocument.GL_ID AND

      first Usr (outer-join) where
Usr.Usr_ID = DDocument.CreationUsr_ID AND


query sort order


DDocument.Company_ID (ascending)
DDocument.DDocumentType (ascending)
DDocument.DDocumentYear (ascending)
DDocument.DDocumentNumber (ascending)


query resultset tqSelectDDocument


field namedata typedb fielddescription
tcBankNumbercharacterBankNumber.BankNumberBank Number
tcBusinessRelationCodecharacterBusinessRelation.BusinessRelationCodeBusiness Relation. A code to identify the business relation.
If this field does not have a input from the user, the system automatically generates a number for the record based on the sequence defined in Business Relation Autonumber Create.
tcBusinessRelationName1characterBusinessRelation.BusinessRelationName1Name: The full name of the business relation.
This field sets the default name for linked addresses such as customers and suppliers.
api annotation:PartialUpdate = yes - defaults to the BusinessRelationCode.
tcBusinessRelationSearchNamecharacterBusinessRelation.BusinessRelationSearchNameSearch Name: An alternate name for finding the business relation. This field can be useful for sorting and filtering.
api annotation:PartialUpdate = yes - defaults to the BusinessRelationCode.
tiCompany_IDintegerDDocument.Company_IDLink to Company
tcCorporateGroupCodecharacterCorporateGroup.CorporateGroupCodeGroup Name
tiCreationUsr_IDintegerDDocument.CreationUsr_IDLogin
tcCreationUsrNamecharacterUsr.UsrNameUser Name
tiCurrency_IDintegerDDocument.Currency_IDCurrency Code
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tiDCollection_IDintegerDDocument.DCollection_IDLink to DCollection
tiDDocument_IDintegerDDocument.DDocument_IDRecord ID
tcDDocumentBankImpRefcharacterDDocument.DDocumentBankImpRefBank Importing Reference
ttDDocumentCreationDatedateDDocument.DDocumentCreationDateCreation Date.This field indicate the payment creation date.
This field is read-only.
tiDDocumentCreationTimeintegerDDocument.DDocumentCreationTimeCreation Time. The time payment is created.
tcDDocumentCreationTimeCalccharactercalculated
ttDDocumentDueDatedateDDocument.DDocumentDueDateDue Date. The date on which the payment is receivable.
tcDDocumentIncassoSelectCodecharacterDDocument.DDocumentIncassoSelectCodeCustomer Payment Selection Code. This field displays the customer payment selection code.
This field is read-only.
tlDDocumentIsOpenlogicalDDocument.DDocumentIsOpenOpen. This field indicates if the payment is completely paid already.
ttDDocumentLastPrintDatedateDDocument.DDocumentLastPrintDateLast Printed Date. This field indicates the most recent printing date.
tiDDocumentNumberintegerDDocument.DDocumentNumberDocument Number. This field hold a unified number for report use.
tdDDocumentOriginalDebitCCdecimalDDocument.DDocumentOriginalDebitCCTC Original Debit. This field holds the debit value of the payment in management currency.
tdDDocumentOriginalDebitLCdecimalDDocument.DDocumentOriginalDebitLCTC Original Debit. This field holds the debit value of the payment in base currency.
tdDDocumentOriginalDebitTCdecimalDDocument.DDocumentOriginalDebitTCAmount.This field hold the value of the payment in the transaction currency. This field must be positive and can be entered manually or automatically by linking the payment to an open item.
tcDDocumentReferencecharacterDDocument.DDocumentReferenceReference. Reference text for the payment.
tcDDocumentStatuscharacterDDocument.DDocumentStatusStatus. The payment status. The default value for a new record is Initial.
tcDDocumentStatusCalccharactercalculated
tcDDocumentSubTypecharacterDDocument.DDocumentSubTypeSubtype. This read-only field indicates that the payment is manual or automatic. You create manual customer payments through the Customer Payment activities, and automatic payments through the Customer Payment Selections.
tcDDocumentSubTypeCalccharactercalculated
tiDDocumentTimesPrintedintegerDDocument.DDocumentTimesPrintedTimes Printed.This field indicates the number of times the payment has been printed.
This field is read-only.
tcDDocumentTypecharacterDDocument.DDocumentTypePayment Instrument. The system displays the payment instrument associated with the payment format linked to the customer bank.
tcDDocumentTypeCalccharactercalculated
tiDDocumentValueDaysintegerDDocument.DDocumentValueDaysValue Days. A value for the number of days required by the bank to process the transaction. The default is based on the payment status entered.
tiDDocumentYearintegerDDocument.DDocumentYearYear/Number. This field displays the accounting year and payment sequence number, which is automatically generated by the accounting year.
tiDebtor_IDintegerDDocument.Debtor_IDCustomer
tcDebtorCodecharacterDebtor.DebtorCodeA code (maximum eight characters) that identifies a customer. If the code you specify matches an existing supplier code, a warning message displays. You can choose to ignore the warning, and create the record. However, when a supplier and customer share the same code, they must reference the same business relation.
api annotation:If you leave the Customer Code field blank, the system automatically generates a number for the record based on the sequence defined in Customer Autonumber Create.
tiDPaySel_IDintegerDDocument.DPaySel_IDLink to DPaySel
tcDPaySelCodecharacterDPaySel.DPaySelCodePayment Selection
tiGL_IDintegerDDocument.GL_IDBank Account
tcGLCodecharacterGL.GLCodeA code identifying the GL account.
tcPayFormatTypeCodecharacterPayFormatType.PayFormatTypeCodeFormat Name
DDocumentCustomcharactercalculatedcustom fields
BankNumberCustomcharactercalculatedcustom fields
PayFormatTypeCustomcharactercalculatedcustom fields
CurrencyCustomcharactercalculatedcustom fields
DebtorCustomcharactercalculatedcustom fields
BusinessRelationCustomcharactercalculatedcustom fields
CorporateGroupCustomcharactercalculatedcustom fields
GLCustomcharactercalculatedcustom fields
UsrCustomcharactercalculatedcustom fields
DPaySelCustomcharactercalculatedcustom fields
ti_sequenceintegercalculatedprimary index
tc_rowidcharactercalculated = rowid(DDocument),rowid(BankNumber),rowid(BankPayFormat),rowid(PayFormatType),rowid(Currency),rowid(Debtor),rowid(BusinessRelation),rowid(CorporateGroup),rowid(DPaySel),rowid(GL),rowid(Usr)


Internal usage


unused


Sample code: how to call this query 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 = "BDDocument".
create ttContext.
assign ttContext.propertyName = "methodName"
       ttContext.propertyValue = "SelectDDocument".
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 = "".

/* Create input dataset */
create dataset vhInputDS.
vhInputDS:read-xmlschema("file", "xml/bddocument.selectddocument.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().

assign vhParameter::icRange = "A"
       vhParameter::icRowid = ""
       vhParameter::iiRownum = 0
       vhParameter::iiNumber = 5 /* Number of records to read */
       vhParameter::icSortColumns = ""
       vhParameter::ilCountOnly = false
       vhParameter::ilForwardRead = true
       vhParameter::iiMaximumBrowseRecordsToCount = 0.

vhParameter = vhInputDS:get-buffer-handle("tFilter").
vhParameter:buffer-create().

assign vhParameter::<field-name-1> = <field-value-1>
       vhParameter::<field-name-2> = <field-value-2>
       ...

/* 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.