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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I obtain an índex of content from a Crystal Report

Status
Not open for further replies.

ejanakieff

Programmer
Sep 9, 2003
62
0
0
ES
I have a Crystal Report that shows the content of several registries.

Normally the content of each registry fits in a page. But some registries occupy two pages.

I would like to be able to generate an index that indicated each registry in what page of report is.

Someone can help me?

Thanks,
Eva Janakieff
 
It has worked correctly.
Thank you very much.

One more a question:

It would wish to keep in the data base the page in which is each registry, because in different reports it is wanted to show that information.

Do you kmow some form to do it?
Thanks, Eva Janakieff
 
What version of Crystal are you using?

Can you give me an example of your data, including the field you want to update?
 
I have installed version 8,5 of Crystal Reports.
I have a data base SQL Server 2000, with different tables.

Report is based on a stored procedure that gives back information of two tables (father-son). I implement it with a report that contains the fathers data (report) and a subreport that shows the sons for each father. I have used stored procedures to obtain the data.

I want to obtain the page where each father is displayed. The father's data are (T_ESMPRE):
* EPR_A_IDESP : identifier int(4)
* EPR_I_NUMREG : int(4)
* EPR_I_NUMPRE: int(4)
* EPR_C_MOTIU : nvarchar(4000)
* EPR_I_PAG : int(4) field taht I want to update with the page where the register is showed.

Thanks,
Eva Janakieff
 
Unfortunatly, you wont be able to update the database from the report with Crystal 8.5. This feature is available in v9 and above.

 
Ok.
Thanks.

Do you know some free UFL that can I use to save the index into a file?

Thanks,
Eva Janakieff
 
If you really want to update the database from CR 8.5, you can do it since you're using SQL Server. Create a stored procedure that takes two parameters: the identifier and an integer (PageNumber). Within the procedure, write the UPDATE stament to update the table, but place a dummy SELECT statement at the end of the proc, like "SELECT Updating = 1".

Since I've no idea how your report is laid out, I can only give you a proposed solution. If your report is grouped by Father, place this formula in the Group Header:
[tt]// @PageByFather
WhilePrintingRecords;
NumberVar PageNum := PageNumber;[/tt]

In the Group Footer, insert a subreport that calls the Update procedure, and link it with the Father identifier, and the @PageByFather formula. It will only fire off for every page if you either view every page, or if you click the 'Last Page' button (>|).

If the group spans more than one page, and you've got 'Repeat Group Header on Each Page' checked, a tweak will be necessary. Create another formula, and place it in the Report Header:
[tt]//@Init
WhilePrintingRecords;
NumberVar PageNum := 1;[/tt]

Then, tweak the @PageByFather formula a bit:
[tt]WhilePrintingRecords;
NumberVar PageNum;
If Previous({T_ESMPRE.EPR_A_IDESP}) <> {T_ESMPRE.EPR_A_IDESP} then
PageNum := PageNumber
else
PageNum;[/tt]

-dave
 
I have a problem:

I have made a stored procedure like you said to me:
CREATE PROCEDURE P_MEPRPAG
@vi_idepr integer=null,
@vi_pag integer=null AS

Update T_ESMPRE set
EPR_I_PAG = @vi_pag

where EPR_A_IDESP = @vi_idepr

Select Updating=1
GO

But when try to insert the subreport referencing this stored procedure, Crystal Reports ask me for the parameters values.

What we are doing wrong?

Thanks,
Eva Janakieff
 
I have made this strored procedure:

CREATE PROCEDURE P_MEPRPAG
@vi_idepr integer=null,
@vi_pag integer=null AS

Select EPR_A_IDESP, EPR_I_PAG
From T_ESMPRE
Where EPR_A_IDESP=0

Update T_ESMPRE set
EPR_I_PAG = @vi_pag

where EPR_A_IDESP = @vi_idepr
GO

But I don't know how to link the input parameters of the stored procedure with the father identifier and the @PageByFather formula.

Thanks,
Eva Janakieff
 
Right click on the subreport > Change subreport links > pick the Father identifier and the @PageByFather formula from the 'Avalable Fields' list, and put them in the 'Fields to link to' list box > Highlight the Father identifier > click the 'Subreport parameter field to use' drop down, and use the tiny little scroll bars on the drop down to select your '@vi_idepr integer' parameter, then do the same for @PageByFather/@vi_pag integer .

-dave
 
I have a problem:

The parameters of stored procedure do not appear list box of fields of subreport, only appear the fields that I have selected in dummy select of stored procedure.

Eva
 
Make sure you're trying to do the linking as I described - there is a known bug in CR 8.5 in which the 'Subreport parameter field to use' drop down doesn't drop down correctly. You need to use the little scroll bars on the drop down to get to your 'real' subreport parameters.

Also, don't use the 'Select data in subreport based on field' section. If you do that, CR will try to create default parameters based on the fields in the subreport (which it sounds like what you're currently experiencing).

-dave
 
Eva,

A simpler solution may be available if you describe WHY you wish to store and present this data. How exactly will use the "page number per father" information?

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thanks.

It had badly established links between report and subreport.
Now, i pass correctly the values of EPR_A_IDESP and Page Number to subreport, but it doesn't update the data base.

My report has a "Detail Section" with the father's information and a "Subreport" that shows the different sons for each father.

I put the PageByFather formula and the "index subreport", that has de update stored procedure, in "Details Section" because I haven't a grouping.

Any suggestion?

Thanks.
Eva Janakieff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top