Click here to Skip to main content
15,887,880 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a crystal report from my ERP vendor and I am trying to add a field to it that exists in a table that isn't one of the tables currently being used by the report.

It is not a simple task of editing this report to add the required tables so the field can be included, so I thought that perhaps I could add a stored procedure to the report and pass to it one of the fields that is part of the report, which it turn would provide me with the field's value that I want to include.

This is, for every record that is being displayed in the report, the stored procedure would be called passing a field from each record, and I would get back the additional field I want to include in the report.

Can you pass a dynamic parameter to a stored procedure in CR that isn't a report parameter ?

What I have tried:

SQL
CREATE PROCEDURE [dbo].[q_GetCOO_byItemID]
@ItemID varchar(max)


AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	select country_of_origin from inventory_supplier
	inner join inventory_supplier_x_loc
	on inventory_supplier_x_loc.inventory_supplier_uid = inventory_supplier.inventory_supplier_uid
	inner join inventory_supplier_trade
	on inventory_supplier_trade.inventory_supplier_uid = inventory_supplier.inventory_supplier_uid
	inner join inv_mast
	on inv_mast.inv_mast_uid = inventory_supplier.inv_mast_uid
	where inv_mast.item_id = @ItemID and primary_supplier = 'Y' and location_id = '10'
END
Posted
Updated 3-May-17 19:50pm

1 solution

Does your main report has itemID?? If yes then u can create a subreport using Stored Procedure by linking the main report ItemID to subreport @itemID Parameter and then u can use shared variable in supreport to make that required field available in main report
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900