Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

Crystal Reports arrays

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
sweetbuttercup
Asked:
sweetbuttercup
  • 4
  • 4
1 Solution
 
peter57rCommented:
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
 
sweetbuttercupAuthor Commented:
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
 
peter57rCommented:
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
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
sweetbuttercupAuthor Commented:
I'm not able to add a table to the server.. any way to do this without creating a tbl
0
 
peter57rCommented:
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
 
sweetbuttercupAuthor Commented:
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
 
peter57rCommented:
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
 
mlmccCommented:
What is the data you have in the records?

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

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now