Hide lines in report with No. = 'XYZ-00*'

aishah
Member Posts: 2
Hi, I'm using Navision 4.0 sp1. In a report, I have a roundloop of table 39 (Purchase Line). In the report, how do I hide lines with "No." = 'XYZ-00*' ( * means there might be other chararcter at the back)?
If the No. = 'XYZ-0011*' or 'XYZ-0099', the line will not appear.
However, if the Document No = 'XYZ-0900', the line will appear.
Can anyone help me with the coding?
RoundLoop - On AfterGetRecord()
SETRANGE(Number,1,PurchLine.COUNT);
intPos := 1;
IF Number = 1 THEN
PurchLine.FIND('-');
ELSE
PurchLine.NEXT;
IF (PurchLine."No." = ???????? ) THEN // I try (PurchLine."No." = 'XYZ-09*' ) but not success.
intPos := intPos + 1;
IF (PurchLine."No." = ???????? ) THEN // I try (PurchLine."No." = 'XYZ-00*' ) but not success.
CurrReport.BREAK; <--I just break the report when it found 'XYZ-00*'
END;
If the No. = 'XYZ-0011*' or 'XYZ-0099', the line will not appear.
However, if the Document No = 'XYZ-0900', the line will appear.
Can anyone help me with the coding?
RoundLoop - On AfterGetRecord()
SETRANGE(Number,1,PurchLine.COUNT);
intPos := 1;
IF Number = 1 THEN
PurchLine.FIND('-');
ELSE
PurchLine.NEXT;
IF (PurchLine."No." = ???????? ) THEN // I try (PurchLine."No." = 'XYZ-09*' ) but not success.
intPos := intPos + 1;
IF (PurchLine."No." = ???????? ) THEN // I try (PurchLine."No." = 'XYZ-00*' ) but not success.
CurrReport.BREAK; <--I just break the report when it found 'XYZ-00*'
END;
0
Comments
-
Hi,
try to compare only the first part of the number with your search string. LikeIF COPYSTR(PurchLine."No.",1,6) = 'XYZ-00' THEN...
With this COPYSTR you take a substring from Position 1 and Length 6 to compare...0 -
NEVER use Magic constants in the code. This is not good. Try to solve it in some systematic way. Like add some setup for the filter, use it etc...
Like why not apply the filter on the record variable directly? Why you are iterating through all lines, when you want only which are different form your filter? Why you are using CurrReport.BREAK when you want to just SKIP the record?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