about STRSUBSTNO features

Get our Free Newletter

Don't you have the time to be online here at DUG every day? So how do you follow what is going on in the Dynamics industry and community?
If you subscribe to the DUG Newsletter then you can relax! We will make sure that you don't miss the big news!

Check out our
Newsletter Subscription Center
page a complete list of our different newsletters.

Solution (Not Verified) This post has 0 verified solutions | 4 Replies | 2 Followers

403 Posts
6,495 Points
Joined: 2011-6-29
Last Online:
2013-5-16 11:58
nikeman77 posted on 2012-10-28 2:15

 

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 recipt 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 Surprise

 

 

 

All Replies

Male
6,751 Posts
156,973 Points
Joined: 1995-10-1
Last Online:
2013-5-19 20:32
Location: Middelfart, Denmark
DynamicsNAVMVP
SystemAdministrator
Solution (Not Verified) Erik P. Ernst replied on 2012-11-1 9:54

Don't really know why you want to use STRSUBSTNO here!

Try:

IF PurchRcptNoFilter = '' THEN
  PurchRcptNoFilter  := PurchRcptHDR."No."
ELSE
  PurchRcptNoFilter += '|' + PurchRcptHDR."No.");

Best regards,
Erik P. Ernst
Webmaster 

DUG’s Admin's Blog

Don't forget to "Verify Solution" the post(s) that solved your problem. This credits the experts who helped, earns you points and marks your thread as Resolved so we all know you have been helped.

Male
49 Posts
980 Points
Joined: 2012-4-25
Last Online:
2013-3-16 1:02
Location: LA/USA
Jay replied on 2012-11-1 18:58

or you can get rid of your nested  IF statement like:

 

PurchRcptNoFilter := '';

IF PurchRcptHDR.FindSET THEN BEGIN

REPEAT

PurchRcptNoFilter += PurchRcptHDR."No." + '|';


UNTIL PurchRcptHDR.Next=0;
END;

PurchRcptNoFilter := COPYSTR(PurchRcptNoFilter , 1, STRLEN(PurchRcptNoFilter )-1);

 

 

Male
1,671 Posts
27,192 Points
Joined: 2000-8-16
Last Online:
2013-5-16 12:49
Location: Vienna, Austria, Europe
Moderator
Thomas Brodkorb replied on 2012-11-1 19:01

Use:

PurchRcptLine.setrange("Order no.", POFilter);

Directly filter the lines by using the order number.
This will solve your problem - even thogh it does not help you to understand how the STRSUBSTNO command works.

 

Thomas Brodkorb


Dynavics & DynamicSolutions Based on the improved budget situation is light at the end of the tunnel is now permanently switched on.

 

Don't forget to the post(s) that solved your problem. This credits the experts who helped, earns you points and marks your thread as Resolved so we all know you have been helped.

 

Male
1,671 Posts
27,192 Points
Joined: 2000-8-16
Last Online:
2013-5-16 12:49
Location: Vienna, Austria, Europe
Moderator
Solution (Not Verified) Thomas Brodkorb replied on 2012-11-1 19:05
Suggested by Erik P. Ernst

IF PurchRcptHDR.FindSET THEN BEGIN
REPEAT
  IF PurchRcptNoFilter = '' THEN   
    PurchRcptNoFilter
  := PurchRcptHDR."No."
  ELSE
    PurchRcptNoFilter := STRSUBSTNO('%1|%2, PurchRcptNoFilter, PurchRcptHDR."No.");
UNTIL PurchRcptHDR.Next=0;
END;

You need a parameter for each %-Value in your string. So when using %1|%2 - the system expects 2 additional parameters - not only one.

Thomas Brodkorb


Dynavics & DynamicSolutions Based on the improved budget situation is light at the end of the tunnel is now permanently switched on.

 

Don't forget to the post(s) that solved your problem. This credits the experts who helped, earns you points and marks your thread as Resolved so we all know you have been helped.

 

Page 1 of 1 (5 items) | Get this RSS feed | Bookmark and Share