Solved

Crystal Reports arrays

Posted on 2013-01-10
9
363 Views
Last Modified: 2013-01-10
I need instructions to create 4 arrays in crystal report. The arrays will have 16 rows each. The arrays values come from 4 fields from the report query and the 16 rows are based on the 16 possible rows per each person (group).

How do a declare the 4 arrays with these characteristics and how do I assign the values then print each value on the report?
The report is grouped by person and shuld display something like:
                              value       Unit           AVG      estimated      
size                         c1_1        c2_1          c3_1       c4_1
height                     c1_2        c2_2          c3_2       c4_2
weight                    c1_3        c2_3           c3_3       c4_3
following 13 more rows...
0
Comment
Question by:sweetbuttercup
  • 4
  • 4
9 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 38763344
Can you explain the data a bit more .  If each row is a separate record then then is no obvious need for any arrays.
Otherwise how do you identify which values go into which row.
0
 
LVL 1

Author Comment

by:sweetbuttercup
ID: 38763394
If each row is a separate record = Yes.

However because of the way I need to display the valued in a grid and leave the empty space if there's no value I think I need and array. The grid has an specific order to display. So
size       = position 1              
height   = position 2
weight   = position 3                

Regardeless the order in the query result.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 38763513
I wouldn't use multiple arrays for this problem myself.

 I would provide a table of 'row headings' which included both the heading and the sort position and then use a left join from the headings table to the main table.  Every heading would be included , there is a sort field to get the correct sequence , and the layout of the columns is completely under your control.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:sweetbuttercup
ID: 38763778
I'm not able to add a table to the server.. any way to do this without creating a tbl
0
 
LVL 77

Expert Comment

by:peter57r
ID: 38763917
Can you not create say an Excel spreadsheet to contain the headings list?

In my opinion, you are in for an enormous amount of coding if you go down the array route for this .

You will have to look at each record to determine the placement of values in the arrays (potentially 16 if statements or a 16 leg case statement); you will have to build the entire report design as a grid of 16 print lines or else build an entire grid of 16 print lines in code-  you will not be able to define just one line and have it repeat.  
You have considerations of how you place the results into the report to create a properly aligned set of data in each column.
0
 
LVL 1

Author Comment

by:sweetbuttercup
ID: 38763941
Need to go back to the array even if a need to create 64+ formulas to display.. The excel or extra tbl are not an option since I need to post this to a Business Obj server and cannot depend on extra files as well.
0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 38764037
WHat a %^&*&!

Arrays are quite simple to use because they are very limited in functionality in Crystal.

Assuming your values are numbers then you do this to declare an array...

Numbervar array Array1;
Redim array1[16];

So you have an equivalent pair of comands for each of the 4 arrays.

Note that unlike some other languages Crystal arrays start at index 1, not 0.

So you would have a formula to fill the arrays as something like...

(repeat all the Numbervar array lines.)
If {table.dimensionfield} = "Size" then   //place in position1
(array1[1]:= {table.ValueField};
array2[1]:=.....;   //unit field
array3[1]:=....;  //avg field
array4[1]:=...... //estimated field
)
else if {table.dimensionfield} = "Height" then   //place in position2
(array1[2]:= {table.ValueField};
array2[2]:=.....;  //unit field
array3[2]:=....;  //
array4[2]:=......
)
....and so on for every dimension

Then as you say, you will need 64 formula fields , each getting one value from one of the arrays to lay out the grid of resulkts.

If you are grouping the report ( so one grid per group) then you need to declare the arrays in the group header and show the results in the group footer.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 38764169
What is the data you have in the records?

mlmcc
0
 
LVL 1

Author Closing Comment

by:sweetbuttercup
ID: 38764219
Yuk!!.. I finished!! It looks pretty ugly with all the formulas but does work!! Thank you..
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question