Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Sage MAS Partner
dhalpin
Posts: 258
Registered: 11-26-2008
0

Address Block on CRW form from drop box udf

I have a drop down box that lists addresses in the SO header table. The address is in horizontal format (Name, Address, City State Zip) How can I get crystal reports to print the address in an address block format on the SO form.

Name

Address

City, State ZIp

 

I know I can use the carriage return feature but not sure how to segregate the lines.

 

Mas 4.50.01

 

Thanks.

Regular Contributor
kanes
Posts: 175
Registered: 10-31-2008
0

Re: Address Block on CRW form from drop box udf

You'll want to create a formula like the following (from 4.30):

 

StringVar BillToName := "";
StringVar BillToAddress1 := "";
StringVar BillToAddress2 := "";
StringVar BillToAddress3 := "";
StringVar BillToCity := "";
StringVar BillToState := "";
StringVar BillToZIPCode := "";
StringVar CRMCompanyName := "";

if {SO_SalesOrderWrk.BillToName} <> "" then BillToName :=
{SO_SalesOrderWrk.BillToName} + chr(13) + chr(10);
if {SO_SalesOrderWrk.BillToAddress1} <> "" then BillToAddress1 :=
{SO_SalesOrderWrk.BillToAddress1} + chr(13) + chr(10);
if {SO_SalesOrderWrk.BillToAddress2} <> "" then BillToAddress2 :=
{SO_SalesOrderWrk.BillToAddress2} + chr(13) + chr(10);
if {SO_SalesOrderWrk.BillToAddress3} <> "" then BillToAddress3 :=
{SO_SalesOrderWrk.BillToAddress3} + chr(13) + chr(10);
if {SO_SalesOrderWrk.BillToCity} <> "" then BillToCity :=
{SO_SalesOrderWrk.BillToCity} + ", ";
if {SO_SalesOrderWrk.BillToState} <> "" then BillToState :=
{SO_SalesOrderWrk.BillToState} + "  ";
if {SO_SalesOrderWrk.BillToZIPCode} <> "" then BillToZIPCode :=
{SO_SalesOrderWrk.BillToZIPCode};
//if {SO_SalesOrderWrk.CRMCompanyName} <> "" then CRMCompanyName = {SO_SalesOrderWrk.CRMCompanyName} _
//+ chr(13) + chr(10)

//if {SO_SalesOrderWrk.OrderType} = "P" then
//    formula = CRMCompanyName + BillToAddress1 + BillToAddress2 + BillToAddress3 + BillToCity + _
//    BillToState + BillToZIPCode
//else
//    formula =
BillToName + BillToAddress1 + BillToAddress2 + BillToAddress3 + BillToCity + BillToState + BillToZIPCode
//end if

 

The lines that are commented out are for CRM installations. You may also want to use the trim() function to take out trailing spaces.

 

Steve

MAS200 V4.30.21