help with codeunit?

spiral
Member Posts: 12
i got a codeunit called formataddress
inside my report:
RecordNo := RecordNo + 1;
ColumnNo := ColumnNo + 1;
FormatAddr.Vendor(VendAddr[ColumnNo],Vendor);
inside my codeunit formataddress:
Vendor(VAR AddrArray : ARRAY [8] OF Text[50];VAR Vend : Record Vendor)
WITH Vend DO
FormatAddr(
AddrArray,Name,"Name 2",Contact,Address,"Address 2",
City,"Post Code",County,"Country Code");
how do i write the vendor procedure inside my report w/o using the
formataddress codeunit?
do i need to declare Name as text, Name2 as text...? i am new to navision
programming and i need help desperate. thanks!
inside my report:
RecordNo := RecordNo + 1;
ColumnNo := ColumnNo + 1;
FormatAddr.Vendor(VendAddr[ColumnNo],Vendor);
inside my codeunit formataddress:
Vendor(VAR AddrArray : ARRAY [8] OF Text[50];VAR Vend : Record Vendor)
WITH Vend DO
FormatAddr(
AddrArray,Name,"Name 2",Contact,Address,"Address 2",
City,"Post Code",County,"Country Code");
how do i write the vendor procedure inside my report w/o using the
formataddress codeunit?
do i need to declare Name as text, Name2 as text...? i am new to navision
programming and i need help desperate. thanks!
0
Comments
-
Hi Spiral
In your report you have to define Dimensions to 8 (a property) for the variable VendorAddr
To call the function:
FormatAddr.Vendor(VendorAddr,Vendor);
Regards
Torben0 -
Thi sis how they use to do it in an old copy of the Vendor Label report from version 1.10 Financials. This is before they had the FormatAddress Codeunit. The Data Item in the report is the Vendor table.
OnAfterGetRecord()
RecordNo := RecordNo + 1;
ColumnNo := ColumnNo + 1;
FormatAddress; // Call a local function to format address.
IF RecordNo = NoOfRecords THEN BEGIN
FOR i := ColumnNo + 1 TO NoOfColumns DO
CLEAR(Addr);
ColumnNo := 0;
END ELSE BEGIN
IF ColumnNo = NoOfColumns THEN
ColumnNo := 0;
END;
NumOfBlanks := NumOfBlanksInput - 7;
OnPostDataItem()
FormatAddress() // This is the local function
IF ColumnNo = 1 THEN CLEAR(Addr);
Addr[ColumnNo][1] := Vendor.Contact; // For Example: if you don't want Vendor Contacts to show then you can comment out this line.
Addr[ColumnNo][2] := Vendor.Name;
Addr[ColumnNo][3] := Vendor."Name 2";
Addr[ColumnNo][4] := Vendor.Address;
Addr[ColumnNo][5] := Vendor."Address 2";
IF STRLEN(Vendor.City + ', ' + Vendor.State + ' ' + Vendor."ZIP Code") > MAXSTRLEN(Addr[ColumnNo][6]) THEN BEGIN
Addr[ColumnNo][6] := Vendor.City;
Addr[ColumnNo][7] := Vendor.State + ' ' + Vendor."ZIP Code";
END ELSE IF (Vendor.City <> '') AND (Vendor.State <> '') THEN
Addr[ColumnNo][6] := Vendor.City + ', ' + Vendor.State + ' ' + Vendor."ZIP Code"
ELSE
Addr[ColumnNo][6] := DELCHR(Vendor.City + ' ' + Vendor.State + ' ' + Vendor."ZIP Code",'<>');
COMPRESSARRAY(Addr[ColumnNo]); // The COMPRESSARRAY function removes all blank lines in the array.
Hope this helps.There is a God!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions