1 Aralık 2011 Perşembe

AXAPTA work with address tables

We have to join some tables. In my sample we will try to get a vendors address:

    DirPartyAddressRelationShip         dirPartyAddressRelationShip;
    DirPartyAddressRelationShipMapping  dirPartyAddressRelationShipMapping;
    Address                             address;
    ;
                    select firstonly * from DirPartyAddressRelationShip join
                        dirPartyAddressRelationShipMapping join address
                        order by
                            DirPartyAddressRelationShip.Shared desc,
                            DirPartyAddressRelationShip.IsPrimary desc
                        where DirPartyAddressRelationShip.PartyId == VendTable::find(vendPAckingSlipJour.OrderAccount).PartyId &&
                              dirPartyAddressRelationShipMapping.PartyAddressRelationshipRecId == dirPartyAddressRelationShip.RecId &&
                              address.RecId == dirPartyAddressRelationShipMapping.AddressRecId &&
                              address.type == AddressType::Service;

DirPartyAddressRelationShip table ties source table with (source table in this sample is VendTable) addresses. In this sample VendTable tables PartyId field join with  DirPartyAddressRelationShip table.
Address tables name is  Address. DirPartyAddressRelationShipMapping table is a bridge between DirPartyAddressRelationShip and Address tables. DirPartyAddressRelationShipMapping tables PartyAddressRelationshipRecId field related with DirPartyAddressRelationShip tables RecId field. DirPartyAddressRelationShipMapping tables AddressRecId field related with Address tables RecId field.

DirPartyAddressRelationShip tables Shared field is shown in vendor form addres tab->general field, IsPrimary alanı da Birincil alanına denk geliyor. Type field is address types combobox. I wanted to get service address so selected as AddressType::Service enum value.

Hiç yorum yok:

Yorum Gönder