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!

Conditional text based on data element 1

Status
Not open for further replies.

dave755

IS-IT--Management
May 3, 2001
69
0
0
US
I have a query that returns a large number of fields of data type "bit". I would like to display those on my report using text different from the default "True" or "False". The BOL has proven useless on this question.

I have tried this:
Code:
=if(Fields!bitvar,"Y","N")
but the compiler barked at me.

I know that I could rewrite my query, but I am hoping for a better solution. Help, please?

Dave Gee
 
Did you try Fields!bitvar.value yet?

Also maybe try values 0 and 1
 
Yes - I have tried Fields!bitvar.value

The complaint from the compiler is:
Code:
The value expression for the textbox ‘bitvar’ contains an error: [BC30201] Expression expected.

Dave Gee
 
given the proc
Code:
create procedure my_bit_test
as
set nocount on
create table #T
(
foo bit,
bar bit
)

INSERT INTO #T VALUES (1,0)

SELECT * FROM #T

DROP TABLE #T

I made a new report with a DataSet that calls this proc.

I dropped a table on the report and deleted one of the columns.

... dragged field "foo" into the first column and field "bar" into the other

changed foo textbox expression: =IIF(Fields!foo.Value , "yeah", "naw")

changed bar textbox expression: =IIF(Fields!bar.Value, "yeah", "naw")

Previewed the report... it looks like it should, no error.


So I looked back at your original code and noticed that it has if instead of iif. whoops!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top