I have read some other posts about this problem, but couldn't get it to work unfortunately.
I have 2 SSRS reports. The first report take a multiple string parameters, runs a select query, and present some rows. Then I have a "Go to Report" Action that pass the values to a sub report and run an update query to update the rows.
When passing the multiple value parameter to another report I used
=join(Parameters!ponum.Value,",") but the sub report only recognize the parameter as 1 value. The parameter on the sub report has set to allow multiple value already.
The type of values I want to pass is like 'a-01', 'b-02', 'd01-293'. However, when passed to another report the parameter becomes a-01, b-02, d01-293
I tried to pass with = "'" + join(Parameters!ponum.Value,"','") + "'" but still fails.
Is there any other ways I can do this?
Thanks
If your subreport's parameter is multi-value like your main report parameter then in the subreport properties all you do is set the parameter value to your main report's parameter.
So if we have MainReport with a parameter called PoNum and it is multi-value. Then we have mySubReport with a parameter of subPONums for example then in the subreport placeholder in the main report, set the parameter value to [#PoNum]
The entire parameter object will be passed to the subreport.
Related
I have a SQL report with two different parameters. The first parameter is hidden, and gets the default value from somewhere else. The second parameter gets default value from the first parameter, and it might return NULL values.
My question is, is it possible to automatically display a message on the report when the second parameter returns NULL values?
If you mean a message dialog (pop-up message) then you cannot do this using the SSRS web portal by default.
If you just want to display some text on the report then you can easily do this.
Add a text box, set the value to whatever text you like, or to an expression if it needs to be more dynamic.
Then set the hidden property of the text box to something like
=IIF(Parameters!myParam.Value = nothing, False, True)
If the parmeter you want to check is multi-value then just reference index 0 to pick up the first entry like this.
=IIF(Parameters!myParam.Value(0) = nothing, False, True)
Is there a way to make columns hidden/visible depending on whether a multi-value parameter is passing in a single value versus multiple values?
Currently my report is hiding Account Name and Account Number fields when searching by account. When searching by a boolean parameter, accountmaster, these columns are hidden with the following expression:
=(Parameters!byaccountmaster.Value = 0)
I would like to modify this argument so that the columns hide only when a single value is passed into the multi-value #account integer parameter.
You can use the .Count of the parameter.
=IIF(Parameters!byaccountmaster.Count = 1, True, False)
I have an existing Access report that runs off a Query. In the existing report I have the parameters set with brackets; [CSRName], [StartDate], and [EndDate]. I have those parameters being filled form a form using the VBA below;
All of this works just fine. My problem is this; I have this query counting the total number of errors a CSR makes. I can easily display in the report the total number of errors. What I'd like to do is have another textbox on the report that shows the total number of completed items by the CSR. In order to do this I need to embed the Control Source for the textbox with another query. I have that query written and it works outside the form. What I need to do though is pass the same parameters that I am using to generate the report into this embedded query on the report. I can't figure out how to do that. I can pass the parameters to the report itself, and it works fine, but trying to do the same won't pass the parameters to the embedded query in the report. It keeps popping up an input box and asking me to give it the variables.
I assumed I could treat the embedded query the same that I could the query the report is based off, so I used the same process to try to pass the parameters to it as well, but it did not work.
Private Sub RunQuery_Click()
DoCmd.SetParameter "CSRName", Me.CSRNameCB
DoCmd.SetParameter "StartDate", "#" & Me.StartDate & "#"
DoCmd.SetParameter "EndDate", "#" & Me.EndDate & "#"
DoCmd.OpenReport "rpt_CSRErrorTracking", acViewPreview
End Sub
What I need is the method to pass the parameters from the form to both the query that the report is based off, and the query embedded in the report itself.
How about having the queries that the report and report field are based on store the "link" to the form's fields something like this (query by form concept)...
In the query's criteria for an appropriate field:
= [Forms]![MyForm]![CSRNameCB]
And:
Between [Forms]![MyForm]![StartDate] And [Forms]![MyForm]![EndDate]
And then on the form that opens the report you don't have to set any parameters at all.
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
I'm new to SSRS 2012 and have a question about variables. I have a report that retrieves order and order line information from our database (order #, order line #, item, quantity, etc). I need to add a textbox to the footer of the report that can only be displayed for certain items (i.e. if item # equals "123" then show textbox, otherwise hide it.
I added a report variable called 'ItemExists', and unchecked the read-only flag, and set the default value to 0.
I then added an expression to the textbox on the report footer to show it if variable=1, and to hide it if variable=0.
I'm trying to add a textbox with an expression to the body of the report (same group as where the item # is displayed), but I'm unable to get the report variable to update properly. Here's what I tried:
=IIF((Variables!ItemExists.Value = 0) and (Fields!item.Value = "123"), (Variables!ItemExists.SetValue(1)), Nothing)
This works if the value of the item is 123, but if the item is not equal to that value, it still sets the ItemExists variable to 1.
The reason I'm checking to see if the variable is equal to 0 is that there may be multiple lines in the report, and if any one of the items is a match, I want the variable to be set to 1.
I'm not sure if I'm way off track here, but if you could provide any assistance on the best way to achieve this, that would be great.
Thanks in Advance.