Technical Questions
 Crystal Reports Forum : Crystal Reports 9, X, XI, 2008 : Technical Questions
Message Icon Topic: Formula Field Based on Stored Procedure Post Reply Post New Topic
Author Message
KellyL250
Newbie
Newbie


Joined: 27 Nov 2009
Location: United States
Online Status: Offline
Posts: 8
Quote KellyL250 Replybullet Topic: Formula Field Based on Stored Procedure
    Posted: 07 Feb 2010 at 7:28am
Hi All,
 
Here's the situation.
There is an SQL table of lookup codes.  The columns in the table are "FIELD", "VALUE", and "DESCR".
 
The data looks like
 
CRA_TYPE      RV     Receiving
CRA_TYPE      AJ      Adjustment
CUST_TYPE    MD     Medical
CUST_TYPE    RT      Retail
 
The main datatables contain a "VALUE" in a particluar "FIELD" and I need to be able to retrieve the appropriate "DESCR" to output on the report.
 
There is a stored procedure that takes 'FIELD" and "VALUE" and selects "DESCR" but I can't figure out how to set it up as a formula field and pass parameters to it for each line.
 
It is basically
 
SELECT DESCR FROM tbLookUp WERE [FIELD]=@FIELD AND [VALUE]=@VALUE
 
The "FIELD" parameter would be static (in this case "CRA_TYPE") and the "VALUE" parameter would be the value of the CRA_TYPE field in each datarow.
 
I can't just use the "VALUE" since more than one field might have the same "VALUE" but a different "DESC".  Only the combination of "FIELD" and "VALUE" is unique.
 
Any help would be greatly appreciated. 
 
Thanks in advance.
 
Larry
 
 
 
 
IP IP Logged
lockwelle
Senior Member
Senior Member


Joined: 21 Dec 2007
Online Status: Offline
Posts: 2019
Quote lockwelle Replybullet Posted: 08 Feb 2010 at 1:25pm
CR will not call stored procs repeatedly.  You need to either a) join to the table or b) select the data at the time of main data retrieval.
 
Some people use the Command object, but I don't believe that this is what it was designed to do, and so, sometimes causes issues.
 
HTH
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.
give feedback!feedback and testimonials