SSRS - How to indent rows in a table with a given content - reporting-services

In SSRS I want to indent certain rows when they start with e.g. 'aa'. See this example:
What is the best practice in this case? As I don't have a parent-child situation here (to use recursive hierarchy group), do I have an option e.g. via the properties to set something like an IIf to solve this? If yes, could you please provide some information where to set this?
Every info is welcome! I'm new to SSRS.

This is simple to do...
Click on the cell that you want to indent.
In the properties panel, expand the Indent properties and then click the drop-down in the Left Indent property and choose Expression.
Then set the expressions to something like
=SWITCH (
LEFT(Fields!FieldIwantToCheck.Value, 2) = "aa", "10pt",
LEFT(Fields!FieldIwantToCheck.Value, 2) = "bb", "30pt",
True, "0pt"
)
You could do this with an IIF expression but if you need to make it more flexible than 1 or two cases then SWITCH is much easier to read/manage.
All we are doing here is checking the left 2 characteras of the FieldIwantToCheck field and setting an indent value respectivley. If none of the criteria match, the final True, Nothing acts like an ELSE and leaves the property as the default Nothing value.

Related

Indenting entire field value in visual studios

I'm trying to create a report that returns it's value indented if it meets a certain criteria in an iif expression. Is there anyway to do this?
I'm not sure if you mean to have the data itself indented or if you want the row to indent for a certain value, but I have a solution for the former issue. There is a set of properties associated with textboxes that deal with indenting text. There is HangingIndent, LeftIndent, and RightIndent. If your data is aligned to the left, you can use either HangingIndent or LeftIndent.
You'll need to put the following expression in whichever indent you require based on the alignment of your data.
=IIF([your Condition here], "10pt", "0pt")
This will indent the data by 10pt if true and leave the data unindented if false. I tested it with a simple dataset that pulled an ID from 1-9 and set the HangingIndent property to indent if the ID was equal to 5.
=IIF(Fields!id.Value = "5", "10pt", "0pt")
Which yielded these results:

RDL report - change of header text in CSV export by parameter

I am working on rdl reports and as I had to add multilingual support, I need to be able to change the column headers' text by the selected language parameter.
I added this very basic custom expression to the header:
=IIF(Parameters!Language.Value="EN", "Date", "DateInDifferentLanguage")
but when I export the report to CSV this is completely ignored, moreover, the column header will be the assigned value's name.
I tried to search for solution for almost 2 days, but the only thing I found that I should use the DataElementName property. Well, for static values it works, but as the text is parameter-dependent I have to use custom expressions and this property does not allow me to use anything like that.
Hopefully, there will be no difference in the solution for grouped columns.
So, my question is: is it possible to add parameter-dependent custom expressions to grouped/not grouped columns?
EDIT: I just realized that you can't set the DataElementName property by expression. I'll leave this up in the off-chance that it may help in some way.
If you're wanting different expressions based on a parameter, try this:
Make sure you can see your Report Data. View -> Report Data(at the bottom)
Start by creating the parameter. Right click Parameters folder in the Report Data window -> Add Parameter... Let's call it 'Language'.
In the available values tab, click Specify Values. Add values for your languages, so the label will be what you want the viewer to see, make the value the same.
Label: English
Value: english
In the Expression you're trying to modify, simply put the available expressions you want in an SWITCH() block.
SWITCH(Parameters!Language.Value = 'english', [do english things],
Parameters!Language.Value = 'spanish', [do spanish things],
Parameters!Language.Value = 'chinese', [do chinese things],
True, [do english things])

show/hide columns in SSRS report 2012 based on Multiselect parameter

i have been trying to hide/show columns within my tablix based on multi value parameter , but whenever i am plugging in the expression in the column visibility properties it is not showing what i select from the parameter and hide what is not select.
Here is the expression:
=IIF(InStr(JOIN(Parameters!parameter.Value,", "),"value"),false,true)
any help???
If I understand correctly, you want to show the column if you select a value which contains "value". Right?
So the expression should be like below:
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,false,true)
I always get this wrong too. I think backwards. It is actually asking for the expression that will hide the column. SO Black_T is correct with his answer.
=IIF(InStr(JOIN(Parameters!Parameter.Value,","),"value")>0,false, true)
so whenever the expression picks up that value in the statement, it will return false, meaning that it should not hide it, and whenever it doesn't find it, well the returned product will also hide it! pretty ingenious!
Thanks and enjoy!
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,true,false)

Only allowing one Drilldown in SSRS

It took me hours of searching and putting together piecemeal parts to find the solution to this, so I figured I'd post it on here in the hopes of helping someone else.
The Problem: We need to display a report, with proper grouping and drilldowns. However, we should only allow one group to be drilled down at one time.
SSRS doesn't exactly have robust scripting options - for instance, you can't close other groups "on click" or anything like that. So how do you do it?
In My example i'm using the AdventureworksDW database. I want to have a dataset that includes the total sales for each group and region. My Stored Procedure looks something like this:
SELECT dst.SalesTerritoryGroup,
dst.SalesTerritoryRegion,
SUM(fis.SalesAmount) AS SaleTotal,
DATEPART(YEAR,fis.OrderDate) AS OrderYear
FROM [dbo].FactInternetSales AS fis
INNER JOIN [dbo].DimSalesTerritory AS dst
ON fis.SalesTerritoryKey = dst.SalesTerritoryKey
WHERE fis.OrderDate < #QueryEndDate
GROUP BY
dst.SalesTerritoryGroup,
dst.SalesTerritoryRegion,
DATEPART(YEAR,fis.OrderDate)
UNION ALL /*The ResellerSales table. Same info.*/
From there I added a table with two groups: SalesTerritoryRegion and its parent, SalesTerritoryGroup. I also added a column to the left INSIDE the SalesTerritoryGroup, with an X (this can also be an image if you'd like). This is the "Drilldown" button that we'll use.
Create a string parameter, mine was #ExpandedGroup. Set the Default to an empty string (so that all the groups start out collapsed). Right click on the SalesTerritoryRegion group, or whatever your subgroup is, and go to the visibility tab. Click "Show or Hide based on Expression" and enter something like this:
=iif(Parameters!ExpandedGroup.Value="" or
Fields!SalesTerritoryGroup.Value<>Parameters!ExpandedGroup.Value,True,False)
This statement means: If we haven't opened a dropdown, or if the dropdown isn't the one selected, set hidden to true. Otherwise, false.
Next click on your "X" column to the left of SalesTerritoryGroup or your supergroup. Right click to go to Textbox Properties. Click the action tab. From there select "Go to Report". When you specify a report, make the target itself (For instance, mine is Main). Then, add parameters to the report.
The most important here is ExpandedGroup. The name should be ExpandedGroup, but the value is not just [ExpandedGroup]. Instead, it's an expression:
=IIF(Fields!SalesTerritoryGroup.Value=Parameters!ExpandedGroup.Value,
"",
Fields!SalesTerritoryGroup.Value)
This expression says: If the Group is the same as the Expanded group, make ExpandedGroup an empty string when you load the report. Otherwise, send the TerritoryGroup value. Essentially, this will let us toggle on and off the drilldown (same as you would in the report if you had traditional drilldowns).
Note: Also be sure to pass other parameters! For instance, my query requires a date to exclude some transaction data. If you don't pass this parameter in the "Go to Report" action, then you'll have to enter it again when you DrillDown. This also means you can give yourself even more flexibility when you click a drilldown (changing a chart that's displayed etc.) which is what I'm doing for this project.
Hope it helps someone out! Of course, if there is a more elegant or simpler solution I'd absolutely love to hear it.

Giving a multiselect combox a default (set of) value(s)

I am currently using multiselect comboboxes to specify filters for a query (that will go on to generate a report).
I have it all working fine, apart from the fact I would like to specify default values to each of these comboboxes when the form is loaded.
It seems like using the builtin default box in the property panel doesn't accept multiple values (or rather I don't know how to give it multiple values)
I have tried selecting the values I want at runtime using the Selected property of the control:
For i = 0 To Me.MyComboBox.ListCount - 1
Me.MyComboBox.Selected(i) = True
Debug.Print Me.MyComboBox.Selected(i) 'Returns false
Next i
But unfortunately that doesn't work. It doesn't give an error or anything, but setting it just doesn't seem to change the value.
Does anyone have any idea on how to achieve this? I would essentially like to go on to have an "All" button next to each combobox that selects all the values in the combobox, so preferably a VBA approach to the problem would benefit me the most.
Any help is much appreciated
Add the following before setting the Selected property:
MyCombobox.SetFocus
MyCombobox.ListIndex = 0