Get data if results object is empty in Crystal Reports - crystal-reports

Bit of an odd question to word correctly, but I have an issue in Crystal Reports for Enterprise by SAP. I designed a report with 2 user input parameters (year & item1). Lets say they pick a year that has no item1, meaning the results object is empty.
They people reading the report still want what they selected in the title of the report with an accompanying "No Data Found", but the problem item1 is an ID, and they want the text representation of item1 which is a different column. When I drag that column onto the report it is of course null because the data comes from the results object which is empty at this time...
Is there any way to have a separate query that could just use the item1 ID to too look up the name, or am I out of luck because the selected parameters have no results?

I ended up creating a subreport that wasn't linked to the main report, thus having 2 separate data objects.

Related

How to generate a page in report for each data row using SSRS

I am working on developing an SSRS report.I have a table in which student name and 6 subjects marks is stored in each row. My problem statement goes like this ---> lets say if 10 rows of data is present in table then I want to create report card/ marksheet for each student in new page but inside a same report. (I.e. 10 pages in one report). Then convert the report containing 10 pages to PDF format and save it in some folder.
Can anyone show some possibilities to achieve my problem statement.
Thanks in advance....
Usually you'll want to use a List object to separate your report by student. You would group the list by student in your report. Then set a Page Break in the List with the location to Between each group so that it separates each student into a separate page.
Then you can put charts, tables and other object inside the list and it will repeat with the list group (in your case, each student).
MSDN: Lists
In this report I made below, the List is highlighted in Red and groups by each site. It just has a table inside. When it's run each site gets it's own page with a list of their people.
Keep in mind that a List is actually just a Tablix with only one data cell - with the column and row headers removed.

Repeat main report rows per each subreport row

I have a JasperReports's report already implemented using below data structure which prints a main record along with its subreport records. The main and the subreport are placed in the same detail band and the subreport uses the JRBeanCollectionDataSource($F{employees}) as its data source expression $F{employees} being the collection field on the main report data type Company.
Company
Name
Location
Employees
Employee
ID
Fullname
etc.
The question is if there is an option in report to repeat the main report columns (Name, Location..) for each subreport record I have for a certain Company?
Basically, I need repeated records in the main report.
I know this is ugly and may look pointless but that is the Business Requirement! Most importantly, I don't want to touch the existing data structure as it's more complex in real case than my example.
Any hint (could be even a hack in JasperReports) is highly appreciated.
Note: I'm using iReport 3.7.3 editor.

Displaying multiple records in Crystal report as comma separated value

I have a view that I am using to display some information in Crystal report file. In some cases, view is supposed to return more than 1 record.
By default, in these cases, Crystal report take the last record and display that one. So, if I have two records with id A and B, I will see only the details of B.
I want to have an option where both A and B are displayed separated by comma.
E.g. if EmployeeDepartment in Employee table has two records (CIS, FINANCE) for employee A, then I want to see #EmployeeDepartment return "CIS, FINANCE" instead of just "FINANCE".
I have been trying to find a way to do this. Till now, I have gotten this far:
Base formula
Shared Stringvar store;
store:=store+{TBL_MR_Header.MRHD_Customer_Ref_No}+ ", "
Display formula
Shared Stringvar store;
store
When I run the report, base formula returns "B," instead of "A,B". Display formula on the other hand displays nothing.
I am unsure what I am missing here.
Edit:
I have created a query that returns the two value comma separated, in both records. So, both records display "CIS, FINANCE" instead of "CIS" and "FINANCE" respectively. Now, I have simple problem, how do I put this query in crystal report file? Only option I can find is to use that datasource expert tool but that does not allow updating query.
Edit:
I actually decided to go different route there. I tried putting the base formula in header and display formula in detail section, but that didn't work either. Turns out, one of my colleague tried a trick to solve similar problem. He used the C# code to call a T-SQL query, got the value in CSV format, and passed it as a parameter. It requires an extra trip to database, but it made it easier.

Crystal Reports XI - Group not returned when adding field which might be null

I'm a very new user of Crystal Reports with no training but with a very light background in programming.
I have been working on a report which should show me some information regarding the order status of parts within my company. I have modified an existing report which had a lot of the information I was looking for and have added several fields containing more information I want to look up (information like stock, delivery date, suppliers and partnumbers). I have one last field I want to add to the report, which shows me the name of the supplier where the part is ordered.
Problem:
When I add this field in the report, the groups where there is no information for this field disappear. When I remove the same field again, the missing groups return.
I have tried to look everywhere for an option or function which suppresses a group when a field is null but can not find anything. I also have tried to add an isNull function to return a certain value when the field is empty, but with no results. Unfortunately I can't review the returned values because the group has disappeared when I add the field.
This problem might have to do with the fact I started working from an existing report, but I have not been able to find a reason to believe so.
Update
I have made some pictures showing the problematic result and the SQL-Query (I can only link to the folder in Onedrive because I'm not allowed to post more than two links at the same time):
http://1drv.ms/1J1enHj

How do I do a CR-type formula in SQL Server Reporting services?

In Crystal Reports, I could define a formula that would evaluate for each detail line. For example, if I had a query that would return a PatientId, an ObsTerm name, and an ObsTerm value, I could define a formula called {#Hispanic} that had the value:
If {Command.OBSNAME} = "HISPANIC" Then
{Command.OBSVALUE}
Else
" "
Then, in the group footer, I could take Maximum({#Hispanic}, {Command.PATIENTID}) to see if I had gotten a value returned for the patient's ethnicity - either I'd get the value (assume only one, since that's how I built the query) or a blank.
I'm trying to convert a CR report over to SSRS 2008R2: how would I do the above? Thanks.
Add a calculated field to your data source (called 'Hispanic' or whatever) with a formula of:
=IIF(Fields!OBSNAME.Value="Hispanic",Fields!OBSVALUE.Value,"")
In your report, add a parent group to your detail row and type [Max(Hispanic)] into a field in the group row. You may then want to hide the detail row and show only the aggregate data. I think there's probably a much easier way to do what you want but it's not clear from your question.
I made the transition from Crystal to SSRS and it is a hard road. You need to unlearn all your Crystal (especially formatting).