Last post Nov 05, 2010 09:56 AM by MyronCope
Nov 05, 2010 08:54 AM|MyronCope|LINK
using vs.net 2005/Sql server.
I have 2 character fields that I am pulling from a db table which I call (names and possible values):
isCondition: Y or N
I want to write something like this in the WHERE part of the Formula editor
If isCondition = "Y" Then
dateStored = ""
the main thing is I want to figure out how to display or hide the field based on the isCondition field. thanks
Nov 05, 2010 09:13 AM|jagjot|LINK
what control you are using to display your data?
posting your code will be very helpful.
Nov 05, 2010 09:16 AM|sansan|LINK
Keep a TextObject and write this formula for Text property.
You can do this in sql itself
SELECT CASE WHEN IsCondition=1 THEN DateColumn
ELSE "" END DateColumn
Try those and see if it works.
Nov 05, 2010 09:20 AM|MyronCope|LINK
that is what I want but I am new to crystal reports.
when I go to "formula editor" I only see what looks like the "WHERE" clause of the sql statement. how do I see the "SELECT" part of the query so I can code the "SELECT CASE..." query that you mention?
Nov 05, 2010 09:39 AM|MyronCope|LINK
hi, i am using a crystal report. I need to modify the query that returns the data.
Nov 05, 2010 09:42 AM|sansan|LINK
There are two ways to do it. I am assuming that a stored procedure is the datasource for the report.
use CASE WHEN THEN.... in the SELECT Query that you write in the procedure.
Drag a TextObject onto the desired report section, details of report header etc., and go to textobject projects and write formula for Text by clicking the little icon to the right.
Nov 05, 2010 09:56 AM|MyronCope|LINK
I realize that using a stored proc would be better.
Right now I have an ODBC connection created in the crystal report and I am using (from top toolbar): Crystal Reports -> Database -> Database Expert
anyways, how do i set a stored procedure as the datasource for my report.
I have an odbc connection setup through database expert would I be able to add the stored procedure there?