about STRSUBSTNO features

nikeman77
Member Posts: 517
hi all,
i have 1 purchase order which had multiple purchase receipt, in a report user will input original purchaser order document, and report will list down all related Purch. Rcpt. Line items and their information. so I tried to get all purchase receipt document no, and filter the documents using PurchRcptNoFilter = item ledger entry.document no.
(eg: PR001 | PR002 | PR005 | PR006 = item ledger entry.document no. )
PROBLEM: I tried to use STRSUBSTNO in following way:
PurchRcptHDR.setrange("order no.", POFilter);
IF PurchRcptHDR.FindSET THEN BEGIN
REPEAT
IF PurchRcptNoFilter = '' THEN
PurchRcptNoFilter := PurchRcptHDR."No." + '|'
ELSE
PurchRcptNoFilter := STRSUBSTNO('%1|%2, PurchRcptHDR."No.");
UNTIL PurchRcptHDR.Next=0;
END;
Output :
PR001 || PR002 || PR005 | PR006 ](*,)
i have 1 purchase order which had multiple purchase receipt, in a report user will input original purchaser order document, and report will list down all related Purch. Rcpt. Line items and their information. so I tried to get all purchase receipt document no, and filter the documents using PurchRcptNoFilter = item ledger entry.document no.
(eg: PR001 | PR002 | PR005 | PR006 = item ledger entry.document no. )
PROBLEM: I tried to use STRSUBSTNO in following way:
PurchRcptHDR.setrange("order no.", POFilter);
IF PurchRcptHDR.FindSET THEN BEGIN
REPEAT
IF PurchRcptNoFilter = '' THEN
PurchRcptNoFilter := PurchRcptHDR."No." + '|'
ELSE
PurchRcptNoFilter := STRSUBSTNO('%1|%2, PurchRcptHDR."No.");
UNTIL PurchRcptHDR.Next=0;
END;
Output :
PR001 || PR002 || PR005 | PR006 ](*,)
0
Comments
-
try this
IF PurchRcptHDR.FindSET THEN BEGIN REPEAT IF PurchRcptNoFilter = '' THEN PurchRcptNoFilter := PurchRcptHDR."No." ELSE PurchRcptNoFilter := PurchRcptNoFilter + '|'+ PurchRcptHDR."No."; UNTIL PurchRcptHDR.Next=0; END;
0 -
PurchRcptNoFilter := STRSUBSTNO('%1|%2, PurchRcptHDR."No.");
You need to use 3 parameters if you have two placeholders in the string... %2 is replaced by nothing...0 -
kine,
thanks for replying.. its typo error.. :oops:
i check my code PurchRcptNoFilter := STRSUBSTNO('%1|%2,PurchRcptNoFilter, PurchRcptHDR."No.");
but still i got an error:A value in the filter "PR001|PR002||PR003||PR004" in the Document No. field in the Item Ledger Entry table is too long for the field type.
Type: Code20
NOTE: The double '||' in the error message above is what I actually saw.0 -
I recommend to use debugger and step through the code. You will see, that didn't create the code very well. Watching the value of your variable will tell you more... ;-)0
-
follow my suggestion...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
- 322 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