[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

CR 8.5 OCX, Use unbound table data for field labels

Posted on 2004-04-07
9
Medium Priority
?
634 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

656 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