Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formula linking subreports

Status
Not open for further replies.

codrutza

Technical User
Mar 31, 2002
357
IE
I am using CRXI, SQL Server, OLE db
I am linking a subreport to a report where
a formula in main report is :"A"+{field}+"B"

For example
In the report I have all the records like "1234567".
In the subreport I have "A1234567B" or "1234567" or "A1234567BC"

I need only the data like "A1234567B"

Linking the formula from report with the field in subreport is working fine just in the main report I get ALL the records; I get a blank subreport for the records which don't mach. Is it a way to bring ONLY the records which mach?

I know I could suppress the blank report but I would prefer to extraxt only the data I need

I have tryed as well using mid function in subreport and link to the field in the main report and is the same.

Thank you and I appologise for my English
 
In general subreports are a bad idea, so you might consider posting technical information and requesting architectural assistance:

Example data
Expected output

Where is the subreport within the main report?

Are you showing data in the main prior to displaying the subreport?

Basics on subreports is that the yhave no intellig3ence about their main reports and vice versa, all you can do is pass shared variables back and forth.

A common solution is to run the subreport PRIOR to showing data in the main report, and then pass back a shared variable which would be used to suppress data.

But you need to share meaningful technical information.

In the main report create a formulka in a section prior to running the subreport:

shared booleanvar IsRecs:=False


In the subreport create a variable such as:

shared booleanvar IsRecs:=True

In the suppress formula of the main report section(s) AFTER the subreport fires use:

shared booleanvar IsRecs;
not(IsRecs)

Another solution which is even worse is to fire the subreport twice, once before to test for values and then later when displaying data.

-k
 
If you can't redesign to avoid a subreport, then click on the subreport, then choose Database>Show SQL Query from within the subreport. Take a look at what the selection rule actually is.

One common problem with linked subreports is that it adds the link as a record-selection in the subreport, additional to any test you already have. Is that the problem?

Regarding redesign, note that you can have the same 'table' twice, the second time as an alias. Does this help?

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Thank you all
I managed to suppress the records I don't want in subreport, but it is running very slow.
I found out that I can use a SQL command instead of the subreport. I am testing it now.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top