Solved

CR 8.5 OCX, Use unbound table data for field labels

Posted on 2004-04-07
9
624 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
Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

 
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 500 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

707 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