Crystal Reports V11 Showing different boolean values per machine - crystal-reports

I'm getting a weird issue with Crystal - I have a basic report that displays records dependant on a boolean value ('open') being true. However, on some PCs it works fine, on others it just shows displays a blank report.
Having done a bit of checking into this, viewing the SQL query seems to indicate that there's an issue with how Crystal is interpreting the boolean value on different machines.
If we select 'Show SQL query' on each of the machines, the ones that don't work show the boolean section as:
`support`.`open`=1
The ones that work show:
`support`.`open`=.T.
...which seems more realistic due to the datasource being a VFP table via an ODBC driver.
I can't quite figure this one out - I suppose it's possible it's something to do with the ODBC driver. Does anybody have any clues as to why this might be happening?
Thanks

The boolean should be directly interpreted through the ODBC... I would change the query to just have
Where 'support.open'
If logical, it will only be .T. / .F. or true / false or 1 / 0... Let the ODBC handler handle it for you.
--- Edit via comment.
I wasn't referring to Crystal's report formula, but the query... But if thats the issue in Crystal, I would change the query that is RETRIEVING the data to be...
IIF( support.open, "YES", "NO " ) as ItemIsOpen
VFP OleDB / ODBC should recognize the IIF() and return the column to a string of "YES" or "NO " respectively... Then use the "ItemIsOpen" column in your report instead of the "support.open" column.

Related

SSRS Report Content Blank

I am having a problem running reports in Sql Server Reporting Services (SSRS) 2008 R2.
After setting up the site, creating a few users, and uploading a few reports, I select a report to run, enter my parameters, and wait for the report to render...but nothing happens. I see the "Loading" animation for a brief amount of time (varies between one and ten seconds irrespective of the report), but it soon disappears, leaving nothing except for the parameters at the top of the page. No report content is rendered at all.
This occurs on every report that I deploy to the SSRS instance regardless of size, number of parameters, etc. Most of the reports have around eight parameters of similar type, and their layouts are all of a relatively tabular format: there are several "sections", each containing a table that may have grouping and/or repeating rows. On average, each table contains about six fields. The queries that support the report datasets are not terribly heavy-weight: I can run them against SQL in under a half-minute in most cases.
I have examined and implemented the solutions in the following questions, but neither of them corrected the issue.
(Related to Safari/Chrome)
SSRS 2008 R2 - SSRS 2012 - ReportViewer: Reports are blank in Safari and Chrome
(Related to running browser as Administrator)
SSRS 2008 - Reporting Services Webpage is Blank except for headers
Other options that I have considered include running the reports from the computer directly instead of through Remote Desktop, and running the reports from other computers on the network other than the server that hosts them. Neither option bears consistent success.
What I have determined, however, is that this problem is directly related to the number of parameters passed to the report. For instance, most of my reports have upwards of six or seven multi-select parameters; each of them is populated at runtime from the database. If users perform a "Select All" or otherwise select a large number of the options in the parameter selection, the above-mentioned issue appears. However, if users are specific with their parameters and only select a few, then the report renders correctly.
Further complicating this situation is the fact that it suffers from the "works-on-my-machine" syndrome. It occurs in some environments but not in others.
As mentioned, I am able to run the reports by limiting the number of selected parameter values; this works in every environment. I am curious, however, as to why this happens (an internal SSRS limit, perhaps?), and what I can do to consistently avoid it in the future.
I had the same problem and by following Alex Zakharov's suggestion I found a parameter that had almost 700 rows with them all selected by default. Deselecting a few rows resolved my issue immediately, but that was unsatisfactory for a production release.
Looking for the log files suggested by lrb (\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles\) I found the following error message:
ERROR: HTTP status code --> 500
-------Details--------
System.Web.HttpException: The URL-encoded form data is not valid. --->
System.InvalidOperationException: Operation is not valid due to the current state of the object.
at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
Solution
This led me to this answer to find and update the web.configs, add the lines of code below and then restart the service.
<appSettings>
<!-- default is 1000 -->
<add key="aspnet:MaxHttpCollectionKeys" value="2000" />
</appSettings>
I had to update in 2 places, because SSRS has separate websites for report manager and report server:
\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\web.config
\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\web.config
SUGGESTION
I just feel like sharing my solution to this question as well. After so much struggle and so many tries, my problem was more on the front end, there was one piece of code which I was missing which was returning blank pages, but the server the report was working well.
Using Angular to return HttpResponseMessage from a web API, initially this is how my call was:
$http.get(url + 'Report/getUsersReport?CustomerId=' + searchCriteria.customerId + '&fromDate=' + searchCriteria.fromDate + '&toDate=' + searchCriteria.toDate).then(getContractsForBackOfficeReportComplete, function (err, status) {defered.reject(err);});
and after add this line of code { responseType: 'arraybuffer' }):
$http.get(url + 'Report/getUsersReport?CustomerId=' + searchCriteria.customerId + '&fromDate=' + earchCriteria.fromDate + '&toDate=' + searchCriteria.toDate, { responseType: 'arraybuffer' })(getUsersReportBackOffice, function (err, status) {
defered.reject(err);});
There is no internal constraints for parameters!
First suggestion:
Do easily debug, with displaying labels if table returns "no value"
I solved the same problem with the corrected query syntax for the parameters in the SQL query:
...
WHERE t.FieldName = ISNULL (#parameter, t.FieldName)
AND t.FieldName2 = ISNULL (#parameter2, t.FieldName2)
...
I ran into the same problem with drop down multi-choice parameter with long list of possible values (>100). Check your situation and investigate which parameter breaks a report.

Crystal Reports Record Section not returning same data as sql

I found a solution that another Tech had posted:
New Formula:
{Product.Size} <> “xsm” or IsNull({Product.Size})
Unfortunately, when preview your report, you will find that this doesn’t work. That is not because of a mistake in our logic but rather, what I consider to be a bug in Crystal Reports. If I took this exact same condition and applied it to the database records using a query analyzer or querying tool, I would see the blank records. Unfortunately, Crystal is not allowing the null values to come through even though our formula says that they should.
The trick to circumventing this bug is to put the IsNull() check FIRST in the formula.
Thus, if we rearrange the condition to this:
IsNull({Product.Size}) or {Product.Size} <> "xsm"
WORKED LIKE A CHARM
Problem is, if I select criteria for the second OR statement ({HiredRate.UTRANSDOC}startswith{?TransYN}) and NO for the first ({HiredRate.UTRANSWEB}startswith{?WebYN}) I get only one record that meets the TransYN criteria. If I switch places in the formula putting ({HiredRate.UTRANSDOC}startswith{?TransYN}) 1st I get all of the data.
When I run the SQL query I get all of the data no matter what order they are in. The Crystal Preview only gives me all of the data on the first from the OR section.
The only thing that stands out looking at the data from SQL is that the one record Crystal is returning has YES in the Transdoc field and the Transweb field is blank. All other records show YES for Transdoc and NULL for the Transweb field.
Here is the Crystal Record Selection Formula
{HiredRate.CONTSUPREF} startswith {?LanguageCombo}
and {HiredRate.ONDATE} = {?ProjectDate}
and {HiredRate.ACTVCODE}= "SIG"
and {HiredRate.RESULTCODE} = "CLM"
and (
{HiredRate.UTRANSWEB}startswith{?WebYN}
or {HiredRate.UTRANSDOC}startswith{?TransYN}
or {HiredRate.UTRANLANL0}startswith{?LanloYN}
or {HiredRate.UINTCONSEC}startswith{?InterpYN}
or {HiredRate.UINTCONF}startswith{?IntConfYN}
or {HiredRate.UINTOPI}startswith{?OPIYN}
)
Here is the SQL query Crystal is using:
SELECT HiredRate.DEAR, HiredRate.CONTSUPREF, HiredRate.LASTDATE, HiredRate.CONTACT, HiredRate.USOURCLANG, HiredRate.UTARGLANG, HiredRate.UTRANSDOC, HiredRate.UTRANSWEB, HiredRate.UTRANLANL0, HiredRate.UINTCONSEC, HiredRate.UINTCONF, HiredRate.UINTOPI, HiredRate.ONDATE, HiredRate.ACTVCODE, HiredRate.RESULTCODE
FROM GoldMine_Main.dbo.HiredRate HiredRate
WHERE HiredRate.CONTSUPREF LIKE 'ENG>SPA%' AND (HiredRate.ONDATE>={ts '2012-04-01 00:00:00'} AND HiredRate.ONDATE<{ts '2013-04-06 00:00:00'}) AND HiredRate.ACTVCODE='SIG' AND HiredRate.RESULTCODE='CLM' AND (HiredRate.UTRANSWEB LIKE 'NO%' OR HiredRate.UTRANSDOC LIKE 'YES%' OR HiredRate.UTRANLANL0 LIKE 'NO%' OR HiredRate.UINTCONSEC LIKE 'NO%' OR HiredRate.UINTCONF LIKE 'NO%' OR HiredRate.UINTOPI LIKE 'NO%')
ORDER BY HiredRate.DEAR, HiredRate.CONTACT
This is happening because the {HiredRate.UTRANSWEB} is null - the rest of the expression is therefore evaluating as null in Crystal, even though (logically) it shouldn't.
When the first two or conditions are swapped around, the {HiredRate.UTRANSDOC} condition evaluates as true and the rest of the expression is short-circuited - which is why records are then selected.

JasperReports parameters works in iReport but fails on JasperReports Server (II)

I have a very similar problem to the one described at [JasperReport parameters works in iReport but fails on JasperServer] post.
The report works properly within the iReport environment using Preview option but fails within JasperReports Server
The comments suggest that iReport does not create the InputControl within JR Server. So I verified that the server contained the proper InputControl (that apparently solved their issue).
The input control called sk serial selection :
ID: ic_sk_serial
Name: sk serial selection
Type: Single Select Query
Mandatory: false
Read Only: false
Visible: true
Query resource:
From repository (pointing to *q_sk_serial* see below)
Value and Visible columns:
Value column: id
Visible query columns: serialnr
The input control query called q_sk_serial (populate the inpute control with a list of alphanumeric serial numbers, items are unique):
select id,serialnr from "public"."serials" order by serialnr;
The parameter name:
ic_sk_serial
The report query:
select * from "public"."datas" datas where datas."serialnr" like $P{ic_sk_serial}
In my case, input control seems to work properly in both environments (within iReport preview and JasperServer): I populate a list of items coming from the same database; I see that dropdownlist as expected within iReport but also on with JR Server.
Within iReport, the drop-down list returns the correct selected value in a report parameter which lead to the correct report. In JasperReports Server I only get a "The report is empty" message. So I tend to think the report parameter is not properly passed through within JasperServer.
Hardcoding the "Input control" output value, shows expected report.
Side note: I am using iReport 4.7.1 in compatibility mode with JasperReports Server 4.5.0.
I would be glad to hear if anybody ran into the same problem?
How can I debug further the report execution in JR Server?
Is compatibility mode susceptible to cause that issue?
What about the input parameter type? I use a query that return a string. However my input data type is text (closest match to string). My parameter type is java.lang.string. Does this make sense?
Actually that is a simple bug:
I just found out that:
value column: id
Should be
value column: serialnr
Still, I do not understand why the report was working in preview mode? Such big mistake should fail on preview no?
In anycase thanks to everybody to lead to my mistake ;)
In my point of view, there are two types of parameter within a jasper report including: Report parameter and Dataset Paramter.
Firstly, you must create both parameters and then map the one of Dataset to the one of Report.
I encountered the same problem to you thus that resolved my case.

Crystal Reports 2008: field shows as blank even when data is returned from the database?

Issue
I have a report in CR 2008 that I inherited from someone else
A sub-report in the report pulls its data from a database view
A field exists, "TRANSCBFLAG" in the view -- it's a string with values of "Y", "N", or "D"
The view has these values
The report displays every other value, but not this one field.
Attempted Resolutions
Suppression attribute? -- No, it's unchecked
Field type issue? -- No, it's a string
Font and background? -- No, it's black font / white background
Suppression / formatting formulas? -- no formulas on display or suppression in subreports or report
Space constraints? -- stretched the field out below all other fields -- still shows as blank
Check to make sure Crystal can see the data -- right-clicked field, select "Browse Field Data", and it came back with the three potential values. So, it can see them in the DB at least, and potentially even in the fields itself.
Just a local Crystal Issue? -- No; I uploaded the report to Business Objects XI for a test and all fields still display except that one.
Question
Where in the process could I be going wrong? It shows when I run the view directly from the database, and every other field shows perfectly in Crystal the first time.
I would assume you did 'Verify Database' but if not that's the first thing I would have tried.
And just a piece of advice... always, always, always run your reports off of a command you write yourself instead of using Crystal's GUI to let you select tables/views/procs. This allows you to make pretty much any kind of change to the query you want and even completely change the source from where your data is coming without wiping all your report controls away. If the modified query has the same field names it will always work seemlessly and if not it will give you a chance to redirect which fields are supposed to come from where. Otherwise... you will have to recreate everything as you just experienced.
There may be a more correct answer, but in a pinch, removing the view from my report (thus removing all fields), adding the view again, and redoing all fields caused the field to display correctly. Not sure how or why.
A further explanation would be appreciated, but for now, that's all I've got.
I had the same issue on a new report I'd created and finally found that the issue was in one of the parameters I used in my command SQL - it had double }} at the end. Eliminating one of the }s allowed the query to return data.
That said, go over the SQL in your database expert with a fine toothed comb, and you'll likely find the issue!

"The Report is empty" - is bug?

I've created report with 3 parameters in iReport and it's running successfully. The report is execute MS SQL stor proc with 3 parameters:
startdate;
enddate;
dept_nm (department name);
iReport gives good result. As soon as I exported jrxml file to JasperReports Server 4.1 I have message "The report is empty".
In the Repository under JasperReports Server I've created controls for dates parameters and single list values for dept_nm parameter.
Do you know how to debug and trace this message coming from???
Your query is returning no data. The message appears when the report result is null.
The quickest way to debug this in JasperReports Server is to modify the report's behavior when no data is returned. The default behavior is "No Pages". Change it to "All Sections, No Details". That way you'll get at least the report title and summary band.
Display your parameters in the title band to see what their values are. Often they aren't what you expect. For example, your input control is "StartDate", but your parameters is "startdate". So the parameter doesn't get the value you thought it would.
I get this a lot. E.g if you have sub reports only, it thinks the main report is blank. You have to do something silly like insert a dummy SQL into your report such as "select 1" then populate a hidden part of the report with the result. When it works on in report studio, but gives you the report is empty on the server (with a good data source - other reports working) is when you have real trouble. Not solved those yet.
Maybe you did not connect your report to any Data Source.