Solved

CR 8.5 OCX, Use unbound table data for field labels

Posted on 2004-04-07
9
619 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
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 100

Expert Comment

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

mlmcc
0
 
LVL 7

Author Comment

by:lewisg
ID: 10784141
Both the labels and T1-T10 are text strings with less than 15 characters.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now