project QadFinancials > class BMfgAddress > method DeleteDockAddressesForCustomer


Parameters


iclstCustKeysinputcharacterA chr(4) seperated list of keys for cust address. Each key has a chr(2) list of components.

<domain>chr(2)<addr>chr(4)<domain2>chr(2)<addr2> etc......
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BMfgCustomer.AdditionalUpdates


program code (program1/bmfgaddress.p)

assign vcList = "":U.
<Q-11 run AdMstrByDomainByOwningCustomer
     (Start) in BMfgAddress >

/* process each list of customer keys and check for any linked docks */
do vii = 1 to num-entries(icLstCustKeys,chr(4)):
    assign
        vcCustomerKey = entry(vii,icLstCustKeys,chr(4))
        vcDomainCode = entry(1,vcCustomerKey,chr(2))
        vcCustomerCode = entry(2,vcCustomerKey,chr(2)) no-error .

    /* Get all ad_mstr key field values (ad_addr and ad_domain) for the passed in CustomerCode */
    <Q-9 run AdMstrByDomainByOwningCustomer (all) (Read) (NoCache)
       (input vcCustomerCode, (Customercode)
        input vcDomainCode, (DomainCode)
        output dataset tqAdMstrByDomainByOwningCustomer) in BMfgAddress >
        
    for each tqAdMstrByDomainByOwningCustomer
        where tqAdMstrByDomainByOwningCustomer.tcad_type = "DOCK":
        
        if vcList <> "":U
        then assign vcList = vcList + chr(4).
        assign vcList = vcList + vcDomainCode + chr(2) + string(tqAdMstrByDomainByOwningCustomer.tcad_addr).
    
    end.

end.
<Q-12 run AdMstrByDomainByOwningCustomer
     (Stop) in BMfgAddress >


/* Use DataLoad method to load all the necessary ad_mstr records identified in step one */
if vcList <> "":U
then do:

    <M-3 run DataLoad
       (input  '':U (icRowids), 
        input  vcList (icPkeys), 
        input  '':U (icObjectIds), 
        input  '':U (icFreeform), 
        input  true (ilKeepPrevious), 
        output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>

    if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0 then Return.

    for each tad_mstr:
        assign vckeycheck = tad_mstr.ad_domain + chr(2) + tad_mstr.ad_addr.
        if lookup(vckeycheck,vcList,chr(2)) > 0
        then do:
            /* For each tad_mstr run the DataDelete method */
            <M-8 run DataDelete
        (output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>
        end.
    end.    

    if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0 then Return.
    
    <M-5 run ValidateBC
       (output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>

    if viFcReturnSuper < 0 or oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.
    
    if oiReturnStatus < 0
    then return.
    
    <M-6 run AdditionalUpdates
       (output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>

    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.
    
    if oiReturnStatus < 0
    then return.
    
    <M-7 run DataSave
       (output viFcReturnSuper (oiReturnStatus)) in BMfgAddress>
    /* Run DataSave method. */
    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.
    
    if oiReturnStatus < 0
    then return.

end.