Print Page | Close Window

possible for mulitple arrays for record selection?

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22730
Printed Date: 27 Apr 2024 at 5:58am


Topic: possible for mulitple arrays for record selection?
Posted By: louvaldez
Subject: possible for mulitple arrays for record selection?
Date Posted: 19 Feb 2019 at 8:47am
Good day everyone,

I have a table called customers with a column called AccountNumber and a column called CustomerNumber.  I have a list of over 500 AccountNumber / Customer combinations from a different database that I want to look up in this customer table.

Each account number has a corresponding customer number so the first element in account number array corresponds to the first element in the customer number array, etc...  I want to load the two arrays with the information given and then use a loop to select the right combination. For this example i only included two records...

Is this even possible in crystal?  When i run this code now, it returns every record in the customer table.

whilereadingrecords;
stringvar array AccountNumberArray   := ["041209", "041430"];
numbervar array CustomerNumberArray  := [7741, 4143005];
numbervar indexValue;
numbervar upperBoundValue := ubound(AccountNumberArray);


for indexvalue := 1 to upperBoundValue do
(
    {customers.accountNumber}   = AccountNumberArray[indexValue]
        and
    {customers.customerNumber} = CustomerNumberArray[indexValue];
)



Replies:
Posted By: hilfy
Date Posted: 26 Feb 2019 at 11:25am
Probably the easiest way to do this would be to put the list into an Excel spreadsheet and then use that as an additional table in your report. By joining from the account number and customer number in the Excel file to the data in your report, you can filter the data in the query instead of having to load and process the arrays.

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window