Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop and counting

Status
Not open for further replies.

thi36

MIS
Feb 26, 2003
1
0
0
US
I am in process of writing a report that collects data from six different fields and then count how many times the data gets repeated in each field. I think I need to use ARRAY and possible loop but not sure how it works. I want to report on the number of count records across the six fields.

The following is an example of the data that i am trying to read. The data is coming from sales orders.

Fld 1 Fld 2 Fld 3 Fld 4 Fld 5 Fld 6
1A 1A 2A 3A 4A 1A
00 00 1A ZZ
1C 1A 1B 1D 4S 3B

I have been using crystal from early this year and still not the knowledge of arrays.

 
give us the report look from the sample data you gave...it isn't clear what you are looking for

Jim Broadbent
 
Question:
I am using this code below. I need to add another array because I exceed the 1000 limit with data I am pulling from my database. Can anyone help me on this?

Setup array formula:
WhilePrintingRecords ;
global numbervar seat_array_position := 0;
global stringvar array out_list := ["", ""];
redim out_list[1000];

stringvar array times:=split({TK_ODET_2003_SB_ASSOC.E_SBLS}," ");
numbervar loops:=ubound(times);
numbervar i;

global numbervar seat_array_position ;

global stringvar array out_list ;

for i:= 1 to loops do(
seat_array_position := seat_array_position + 1 ;

stringvar chnge:=times ;//3:308:1:18,6
stringvar end:= mid(chnge,instrrev(chnge,":")+1);
stringvar back:=right(end,len(end)-instr(end,",")) ;
if instr(end,",")-1 >= 0 then
stringvar front:=left(end,instr(end,",")-1 )
else front := "" ;//drops certain values, need to look at this...
stringvar begin:=left(chnge,instrrev(chnge,":"));

out_list[seat_array_position]:= begin&back&"-"&front;
);
// following line needed to avoid having formula return an array as an result (not allowed syntax)
""

I have three other formulas that display my out put:
out put 1 formula:
whileprintingrecords ;
global stringvar array out_list ;
local numbervar seat_counter ;
local numbervar seat_counter_start := 1 ;
local numbervar seat_counter_end := 15 ;
local stringvar array sub_seat_set := ["",""] ;
redim sub_seat_set [15] ;

for seat_counter := seat_counter_start to seat_counter_end do
sub_seat_set [seat_counter] := out_list [seat_counter] ;

join ( sub_seat_set , " ")

out put 2 formula:
whileprintingrecords ;
global stringvar array out_list ;
local numbervar seat_counter ;
local numbervar seat_counter_start := 16 ;
local numbervar seat_counter_end := 30 ;
local stringvar array sub_seat_set := ["",""] ;
redim sub_seat_set [15] ;

for seat_counter := seat_counter_start to seat_counter_end do
sub_seat_set [seat_counter - 15] := out_list [seat_counter] ;

join ( sub_seat_set , " ")

How can i add to my array and my formulas to include 1000 or 2000 more spaces in my arrays???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top