Formatting address information on Customer Statement

Hi,

I need a small work around to display the customer address in a specific format on Customer Statement? Currently, the output comes from the FormatAddr codeunit and I don’t want to touch that module. Is there any way of tweaking the CustAddr array variable to display the address info as follows.

Customer Name

Customer Address

Customer Address 2

Customer City

Customer Country

Customer Phone

Customer Fax

Any help would be much appreciated.

Thanks,

Vinod

Hi Vinod,

You can just assign it yourself. The idea of the format address function is to format the address to the format set on the country/region table and then compresses the array.

comment out the format address call and assign the variable as you want. If you do not want blank line then call the COMPRESSARRAY function e.g. COMPRESSARRAY(CustAddr);

Got the answer.

Declare an integer variable i.

The on the Customer - OnAfterGetRecord() event, add the below code after the FormatAddr.Customer(CustAddr,Customer); line.

for i:= 1 to arraylen(CustAddr) do

if (CustAddr[i]=Customer.“No.”) or (CustAddr[i]=Customer.“Contact”) then

CustAddr[i]:=’’;

Compressarray(CustAddr);

Hi Vinod,

Yes if you still want to use the country address format funucionality

If not then it’s more simple than that i.e.

CustAddr[1]=Customer.Name;
CustAddr[2]=Customer.Address;
CustAddr[3]=Customer.“Address 2”;


COMPRESSARRAY( CustAddr );

How do I get the Country Name from the country table?

Customer.Country gives me the code of the country (AE, IN, UK, etc) only? Is there any way I can use GET keword?

Thanks

Hi Vinod,

Declare a variable of Datatype record and Subtype Country/Region (e.g. CountryRec) then you use the command

CountryRec.GET( Customer.Country );