How to get customer Alternate address by coding in MSD Axapta

To get customer Alternate address by coding in Axapta you need to use table dirpartytable which directly related to address tableby recid and tableid with address table. Custtable has unique partyid for each customer.

 CustTable custTable;  
 Address address;  
 DirPartyTable DirPartyTable;  
 ;  
 select custTable where custTable.AccountNum == '00000234';  
 select DirPartyTable where DirPartyTable.PartyId == custTable.PartyId;  
 while select address where address.AddrRecId == DirPartyTable.RecId  
 && address.AddrTableId == DirPartyTable.TableId  
 {  
 info("Name "+address.Name+" street "+address.Street+" zip "+address.ZipCode+" city "+address.City+" state "+address.State);  
 }