?
Solved

CR 8.5 OCX, Use unbound table data for field labels

Posted on 2004-04-07
9
Medium Priority
?
628 Views
Last Modified: 2008-02-26
I have a report that has 10 fields with data. Lets call them T1 through T10. Each field needs a label. Currently the labels are entered as text objects which requires them to be modified manualy in the .rpt file. The .rpt file looks something like this in the Details section:

label1  T1       label6   T6
label2  T2       label7   T7
label3  T3       label8   T8
label4  T4       label9   T9
label6  T5       label10 T10

What I would like to do is get the label data from an seperate table in the MDB. In other words there are lots for records with data for T1 through T10 and the table with the label data has 10 records

How do I do this?

I tried doing it with an unbound table but every time I try CR complains "Your current link configuration contains multiple starting points" and links the table anyway.

Is there a way to do this with an array?

Any ideas?
0
Comment
Question by:lewisg
[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
  • Learn & ask questions
9 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 10781442
Hello lewisg,

Does each data record have all of T1 to T10 or just one of them?
If just one value, how do you know which one?

Pete
0
 
LVL 7

Author Comment

by:lewisg
ID: 10782401
Greetings Pete!

All 10 labels must print for each record. There could be data in any one or all of T1 to T10 for any given record.

Thanks
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 10783210
What does the data look like?

mlmcc
0
Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

 
LVL 7

Author Comment

by:lewisg
ID: 10784141
Both the labels and T1-T10 are text strings with less than 15 characters.
0
 
LVL 28

Accepted Solution

by:
bdreed35 earned 2000 total points
ID: 10784796
Here is the thought I had for your problem:

Insert a subreport in the report header.
The datasource for your subreport should be the table that contains your label information.
Create these formulas in the subreport:

@init_array
shared stringVar array labels;
redim labels[10];
""

Place @init_array in your report header.

@load_array
shared stringVar array labels;
labels[recordnumber] := {table.field}

Place @load_array in your details section.

Suppress all sections in your subreport so that they don't display when you view the main report.

In the main report, create a formula to display the array:

@display_array
shared stringVar array labels;
labels[recordnumber]

Place this in your details section of your main report.

It may require some tweaking, but I think this is the basic structure that you need.

0
 
LVL 7

Author Comment

by:lewisg
ID: 10785811
Almost there!!!

During @display_array in the main report I get an error that says "A subscript must be between 1 and the size of the array". It appearts that the shared stringVar is not visible in the main report.


Thanks!!!
0
 
LVL 28

Expert Comment

by:bdreed35
ID: 10785899
Make sure that the subreport is in a seperate section in the main report than the @display_array, AND that the subreport is in a section above the @display_array formula.

The other issue may be "recordnumber".  If you have more than 10 records being returned in the main report, than it will try to use a subscript that is out of range.

You can try altering the @display_array formula like this:

@display_array
//**************************
shared stringVar array labels;

if recordnumber < 11 then
    labels[recordnumber]
else
    "";
//**************************
0
 
LVL 7

Author Comment

by:lewisg
ID: 10786135
I have the subreport in the main report header and it appears to work properly.

Since I need to place each of these labels on the report I have been trying to place individual Formula Fields for each array element. What I have looks like this:

@display_array_T1
shared stringVar array labels;
labels[1]

The above works in the subreport...

0
 
LVL 7

Author Comment

by:lewisg
ID: 10786542
bdreed35,

Thanks so much!

I have the report working properly now. It appears that @init_array has to be in the main report to scope the variable correctly.

I put @init_array and the subreport with @load_array in the main Report Header. At first I had the RH suppressed and it did not work - DUH.

This is great, I don't have to change the underlying MDB...

After re-reading my previous comment it makes NO sense. What I was trying to say was that the subreport appeared to work properly but apparently the array variables were not accessable in the main report. Oh well...

Thanks again, excellent answer!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

770 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