Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Crystal Reports arrays

Posted on 2013-01-10
Medium Priority
371 Views
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
Question by:sweetbuttercup
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 4
• 4

LVL 77

Expert Comment

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

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

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

LVL 1

Author Comment

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

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

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

peter57r earned 2000 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 101

Expert Comment

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

mlmcc
0

LVL 1

Author Closing Comment

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

## Featured Post

Question has a verified solution.

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

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â€¦
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonstâ€¦
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrasâ€¦
###### Suggested Courses
Course of the Month8 days, 3 hours left to enroll