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!

Data in report different than view output

Status
Not open for further replies.

BobWman

Programmer
Jan 7, 2002
169
0
0
US
I have created a SQL Server view for a Crystal 8.5 report. The view returns a Remark field, which is a compilation of remarks from several tables. If a remark in a table is empty, there should be no output in the report. If the remark is not empty, the output identifies the table as well as displaying the remark. This is the part of the view that pulls the data:
Remark = Substring(IsNull(' (Log) ' + L.Comment,'')
+ IsNull(' (Sieve) ' + S.LabRemark,'')
+ IsNull(' (Sieve8) ' + S8.LabRemark,'')
+ IsNull(' (PI) ' + PI.LabRemark,'')
+ IsNull(' (R-Value) ' + R.LabRemark,'')
+ IsNull(' (Proctor) ' + PR.LabRemark,'')
+ IsNull(' (Agg. Prop.) ' + AP.LabRemark,'')
+ IsNull(' (Soil Prop.) ' + SP.LabRemark,'')
+ IsNull(' (Hydrometer) ' + H.LabRemark,'')
+ IsNull(' (Consol) ' + C.LabRemark,'')
+ IsNull(' (Dir. Shear) ' + DS.LabRemark,'')
+ IsNull(' (Spec. Grav.) ' + SG.LabRemark,'')
+ IsNull(' (Misc) ' + M.LabRemark,''), 1, 255),

When I run a select statement against the view, I get the output I want. For example, the Remark field contains:
(Log) SALog Comment (Sieve) Sieve remark (PI) PI Remark

However, when I run the report, I get the label for every table, even when the remark field is null.
For example:
(Log) SALog Comment (Sieve) Sieve remark (Sieve8) (PI) PI Remark (R-Value) (Proctor) - etc.

The Sieve8, R-Value and Proctor tables have no remarks, and should not show up in the report, but they do.

Any idea what is going on?

Thanks.
 
I realized I can simplify this question. I create this view:

Create View vTest As
Select Remark = IsNull('A' + Null, '')

Then I can run a query:

Select * from vTest

The query returns an empty string.

When a report is created from the view, it returns the value "A".

Why does the report return a different value than the Select statement?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top