SSRS - Change Font Colour on Subreport - sql

I have a main report that pulls data from our CRM datasource:
-Project No
-Voucher No
-Cheque No
Then I have a subreport that is from a different GP datasource and displays
-Cheque No
These are linked on Voucher No.
The subreport works great, however I need a way to change the font colour if the Subreport "Cheque No" and the Main Report "Cheque No" do not match.
Can I use an expression to check that they match?
Note: I have tried to use two separate datasets within the same report and use a lookup to pull in the cheque number from GP, however it gives me #error, and I am not sure why.

You can simply add a parameter to you sub report. That would be evaluated at the SSRS level and appropriate with in the SR.

Yes you can do this by Using Expression in SSRS Report.
your sub report is linked on [voucher no] you need add one more parameter in your sub report [ChequeNo] and pass it from your main report .
Now you have to right click on your textbox property select Font Select color and Expression of Color
=IIF(Parameters!ChequeNo.Value<>Fields!ChequeNo.Value ,"Red","Black")

Related

Option choices for Jasper Reports input controls don't appear

The available choice names for my input controls are not showing. I am not sure if it's the way a set the input controls. Also I would like to use a dropdown list instead of a checkbox. How can I correct these issues. Please see the current look in the image below:
Also, I tried using the "Multi-select Query" and added the visible columns but got Null for the options.
Here is a screenshot.
I also used the following query which has two options which I added as the visible columns.
SELECT DISTINCT tran_type FROM prov.ATrans ORDER BY tran_type
In JasperReports Studio, I created a parameter of Class java.util.Collection with the "Default Value Expression" of
new ArrayList(Arrays.asList("Subscription", "Redemption"))
These are the values I expect to see but appear as null.

Passing parameter results to subreport command

I have a subreport that will search a table pulling all matches depending on two things. 1.) Some filtering criteria in the command for the subreport and 2.)it will search based on the criteria pulled by a parameter from the main report.
1.) Is this possible? I have tried for a few days now to get this to work but I feel I am missing something. I cannot get the field in the main report to pass the information to the parameter for the command in the subreport.
Here is the command for the subreport.....
DECLARE #DIE VARCHAR (20)
SET #DIE = '1315240018'
SELECT DISTINCT BCKUPDIE.TOOL1
FROM FS11HD AS BCKUPDIE
JOIN FS11HD AS ORGDIE
ON
BCKUPDIE.DIE_SHAPE = ORGDIE.DIE_SHAPE
AND BCKUPDIE.AROUND1 = ORGDIE.AROUND1
AND BCKUPDIE.ACROSS1 = ORGDIE.ACROSS1
WHERE ORGDIE.TOOL1 = #DIE
When run in sql it will give me any TOOL1 rows that have matching criteria. This is what I want my subreport to, am I going about this the wrong way?
We have an old version of Crystal report (XI) but the logic might be the same with your version.
On the menu select [Edit] [Subreport Links].
Select the sub report from the pick list then map your select choices to the sub reports selection criteria.
On the sub report you will have to have parameter fields that will match the values up with the values you wish to pass. Such as if you select date as a selection criteria on the main report and you want the sub report to also filter by this date create a date pram in the sub report. By linking all the select criteria with [linked] values it will behave as a straight through pass of the parameters without a prompt box being all have been answered via the linkage between documents.
I feel you took difficult path to achive your requirement, Try below solution I hope this will be easy to implement.
Firstly remove the #Die from command instead pass the #Die value from main report as part of formula field.
your subreport query will be changed to
SELECT DISTINCT BCKUPDIE.TOOL1
FROM FS11HD AS BCKUPDIE
JOIN FS11HD AS ORGDIE
ON
BCKUPDIE.DIE_SHAPE = ORGDIE.DIE_SHAPE
AND BCKUPDIE.AROUND1 = ORGDIE.AROUND1
AND BCKUPDIE.ACROSS1 = ORGDIE.ACROSS1
In main report create a formula #Die and enter data as '1315240018'.
Now link main report and sub report and in linking pass the #Die formula and your main report parameter to sub report, By this you have these as parameters in sub report.
In record selection of sub report write as below.
ORGDIE.TOOL1 = ?Die //value passed from main report
and your parameter linking
By this your filtering criteria will be added to the sub report query.
This should work let me know incase any error

Creating a form where user inputs start and end dates of a report

I am working on MS Access 2007.
I am trying to create a form where the user will input 2 dates - a start date and an end date. I want these dates to become the boundaries of a report.
For example if the user inputs 01/03/14 and 10/03/14, I want Access to create a report of the data (eg Selling Price) between these two dates.
How can I do this?
There are a few ways to perform this.
The easiest, and most straight forward, in my personal opinion, involve creating a form where the user(s) will be entering Start/End dates, using a query that captures all of the information necessary for your report (including your date parameters), and the report with your query as the recordsource.
Form
Create a form with 2 text box controls: Name them whatever you like (StartDateTxt, EndDateTxt, for example), and a button control.
Query
Now, create a query, that retrieves all of the correct information you need for this report. I know you said selling price, for starters.
For the date fields you want to narrow down your search by, you need to put them in the WHERE clause or the Criteria field in QBE. It might look something like:
[Forms]![YourFormName]![StartDateTxt] and [Forms]![YourFormName]![EndDateTxt]
Note: Referencing fields can sometimes be tricky.
Report
Next, you need to create a report. If you're new to this, you can use the Report Wizard located at: Create - Reports section - Report Wizard.
You can select your query from the dropdown list on the first prompt, and add the fields you desire/need. Click next: Here you can sort your order of appearance on the report. Click next: Then you can justify your layout - if you aren't familiar with the differences, you can play around with them. Click next: Select a 'theme' to be applied to your report (font/colors, etc). Click next: Then you can either preview the report or Modify the report's design. (Really, you can do either, by clicking either button and clicking print preview or design view.)
If you click on Preview the report - Access should ask you for any parameters your underlying query requires.
Back to the form.
Right click on your button control. -> Properties -> Event -> OnClick -> click the [...] icon to the very right of the row. Select code builder.
VBA
In-between Private Sub and End Sub, you're going to write
DoCmd.OpenReport "YourReportName"
You can also check to make sure your report isn't already open.
Dim ReportName As String
ReportName = "YourReportName"
If CurrentProject.AllReports(ReportName).IsLoaded Then
DoCmd.Close acReport, ReportName
End If
DoCmd.OpenReport ReportName, acViewPreview
I hope this helps you/answers your question.
Edit: If anyone wants to edit/add on to this either by means of clarification or another alternative approach, please feel free. Just let me know.

sub report header need to show were ever sub report is shooing in crystal report

I have a crystal report like this:
In this crystal report i have 2 sub reports
1.Delparkingtype.rpt
2.DelivaryDetailedrpt
i want to show DelivaryDetailedrpt headers where ever showing DelivaryDetailedrpt report
i try to set property repeat on horizontal pages..but that is not affecting any where..
so what i have to do
if any one know how to show subreport header to show where ever sub report showing..please help me
Subreports don't have Page Headers or Footers, but there is a workaround to getting them displayed by creating a "dummy" group. A great tutorial on how to do this can be found here.

sum up sub-report data and show in main report

I'm using Pentaho Report Designer. I want to sum up the sub-report data and show it to my main report. Can it be possible?
If possible, how to make it.
Example : total0 is sum of month1,month2,month3...month12
Main Report: total0
Sub-report: month1 month2 month3...month12
yes, however your subreport must execute and display first. The trick is just to add an itemSumFunction inside the subreport, and then pass that back to the main report via a parameter ( click on parameters inside the subreport and make sure it is added to the "export" parameters list.