Print Page | Close Window

Select records from an array

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9816
Printed Date: 04 May 2025 at 11:20pm


Topic: Select records from an array
Posted By: elafito
Subject: Select records from an array
Date Posted: 26 Apr 2010 at 9:43am
Hello,
 
   I have a webproject, where I want receive multiple parameters dynamically. I receive this values in SALES REP in this way (2,34,53,40), so I try to put all this values into an array and then look for them inside the table, but it's giving me this error:
 
"A subscript must be between 1 and the size of the array. Details: errorKind Error in File LE777 {D8EFF973-FF68-48FA-B19E-282729765CDE}.rpt: Error in formula Record_Selection: 'NumberVar ListSize := Count(Split({?SALES REP},"|")); ' A subscript must be between 1 and the size of the array. Details: errorKind " And SALES REP is not empty.
 
This is the code in the Report Selection Expert:
 
NumberVar ListSize := Count(Split({?SALES REP},"|"));
StringVar Array List[ListSize];

NumberVar i;

for i:=1 to ListSize do
(       
        List = Split({?SALES REP},",")
);


{LE10.PRIM_SREP_NUM} in List
 
 
Any idea about how to do this? Is it possible to select records from an array as I am trying to do?
 
Thank you.



Replies:
Posted By: elafito
Date Posted: 26 Apr 2010 at 10:49am
I solved the error, but looks like not matter if the array is empty or not, I get the same results.


Posted By: elafito
Date Posted: 27 Apr 2010 at 4:55am
Can I do just: {LE10.PRIM_SREP_NUM} in {?SALES REP} being SALES REP a string like this "55,65,5,12,4,78"?



Print Page | Close Window