project QadFinancials > class BBusinessRelation > method GetAddressWithKeyFields

Description

Thie method return address info by addresslogickeystring addressstreet1,2,3,addresszip addresscity,addresstypecode.


Parameters


icAddressStreet1inputcharacter
icAddressStreet2inputcharacter
icAddressCityinputcharacter
icAddressStreet3inputcharacter
icAddressZipinputcharacter
iiBusinessRelationIDinputinteger
icAddressTypeCodeinputcharacter
oiAddressIDoutputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDebtorEndUser.ValidateComponentUpdateAllSharedEndusers
method BDebtorShipTo.ValidateComponentUpdateAllSharedShiptos


program code (program3/bbusinessrelation.p)

/* Find the address record in the instance */
for first tAddress
    where tAddress.addressStreet1 = icAddressStreet1
      and tAddress.addressStreet2 = icAddressStreet2
      and tAddress.addressStreet3 = icAddressStreet3
      and tAddress.addressCity = icAddressCity
      and tAddress.addressZip = icAddressZip
      and tAddress.businessRelation_ID = iiBusinessRelationID
      and tAddress.tcAddressTypeCode = icAddressTypeCode:

    assign oiAddressID = tAddress.address_id.
end.    

/* If the record does not exist in the instance then check the db*/
if not available tAddress
then do:    
     <Q-3 run AddressByIdByCode (all) (Read) (NoCache)
        (input icAddressCity, (AddressCity)
         input icAddressStreet1, (AddressStreet1)
         input icAddressStreet2, (AddressStreet2)
         input icAddressZip, (AddressZip)
         input icAddressTypeCode, (AddressTypeCode)
         input '', (AddressID)
         input iiBusinessRelationID, (BusinessRelationID)
         input '', (BusinessRelationCode)
         input '', (AddressTypeID)
         input icAddressStreet3, (AddressStreet3)
         output dataset tqAddressByIdByCode) in BBusinessRelation >
       
    /* Copy the resultset into the Address Temp-table */
    /* Using the tqAddressByType temptable to populate the ad_mstr does not work */
    for first tqAddressByIdByCode 
      where tqAddressByIdByCode.tcAddressStreet1 = icAddressStreet1
        and tqAddressByIdByCode.tcAddressStreet2 = icAddressStreet2
        and tqAddressByIdByCode.tcAddressStreet3 = icAddressStreet3
        and tqAddressByIdByCode.tcAddressCity = icAddressCity
        and tqAddressByIdByCode.tcAddressZip = icAddressZip
        and tqAddressByIdByCode.tiBusinessRelation_ID = iiBusinessRelationID
        and tqAddressByIdByCode.tcAddressTypeCode = icAddressTypeCode:

        assign oiAddressID = tqAddressByIdByCode.tiaddress_id.
    
    end. /* end of for each */
end.