Solved

CR 8.5 OCX, Use unbound table data for field labels

Posted on 2004-04-07
9
620 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

772 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