Recently I was asked by one of the customers to generate the list of all customer addresses with their purpose. The job below retrieves the information with ease.
static void
GetCustomerExtract(Args _args)
{
CustTable custTable;
DirPartyTable dirPartyTable;
LogisticsPostalAddressView postAddress;
LogisticsLocationRole
logisticsLocationRole;
LogisticsLocationParty
logisticsLocationparty;
int
iCount = 0;
CommaIo file;
;
file = new
CommaIo(@"FILEPATH","W");
file.write("dirPartyTable.Name","dirPartyTable.RecId","custTable.AccountNum","custTable.InvoiceAccount","custTable.TaxGroup","custTable.SalesGroup","custTable.DataAreaId","logisticsLocationRole.Name","postAddress.LocationName","postAddress.County","postAddress.District","postAddress.PostBox","postAddress.Address","postAddress.BuildingCompliment","postAddress.City","postAddress.CountryRegionId","postAddress.Latitude","postAddress.Longitude","postAddress.State","postAddress.Street","postAddress.StreetNumber","postAddress.TimeZone","postAddress.ZipCode","postAddress.PostalAddressRecId","postAddress.PostalAddress","postAddress.DistrictName","postAddress.ISOCode);
while
select custTable
join
dirPartyTable where (custTable.Party
== dirPartyTable.RecId)
join
logisticsLocationparty where
(custTable.party == logisticsLocationparty.Party)
join
postAddress where
(logisticsLocationparty.location == postAddress.Location)
join
logisticsLocationRole where
(logisticsLocationparty.LocationRole == logisticsLocationRole.RecId)
{
file.write(dirPartyTable.Name,dirPartyTable.RecId,custTable.AccountNum,custTable.InvoiceAccount,custTable.TaxGroup,custTable.SalesGroup,custTable.DataAreaId,logisticsLocationRole.Name,postAddress.LocationName,postAddress.County,postAddress.District,postAddress.PostBox,postAddress.Address,postAddress.BuildingCompliment,postAddress.City,postAddress.CountryRegionId,postAddress.Latitude,postAddress.Longitude,postAddress.State,postAddress.Street,postAddress.StreetNumber,postAddress.TimeZone,postAddress.ZipCode,postAddress.PostalAddressRecId,postAddress.PostalAddress,postAddress.DistrictName,postAddress.ISOCode);
iCount++;
}
info(int2str(iCount)+" Records exctracted");
}
No comments:
Post a Comment