I need to display multiple charts in an SSRS-Report. With multiple charts i don't mean multiple series in one chart area - i mean for each value a new chart area with an own chart. I don't know if this is possible but i'll give it a try :).
The data source is a table containing multiple rows and columns. One column contains a value containing the material no. Now i need to create a new chart for each material no. in this data table. The whole thing should look like this:
The number in the brackets is the material no. As you see i need to create one own chart for each material no. Is this possible?
Important: The material no. can exist multiple times in the data table but only one chart should be displayed for one material no. The values which belong to the specific material no. will be aggregated
Update #1:
First a screenshot showing the data the data source returns:
The expression for the hiding looks like this:
Table 1
=iif((RowNumber(Nothing) Mod 2) <> 0 AND (RowNumber(Nothing) Mod 3) <> 0, False, True)
Table 2
=iif((RowNumber(Nothing) Mod 2) = 0, False, True)
Table 3
=iif((RowNumber(Nothing) Mod 3) = 0, False, True)
Here is a screenshot of the three tables inside the report.
All three tables display the material no. They are all bound to the same data source with the row visibility expression posted aboth. The group expression for the row looks like this (typeMaterial is the column yieldTypeMaterial):
At the end, it results in this:
We can achieve this by putting the chart in table list and group the row by "Material No." and design the chart as per your requirement. By this, 1 chart will be displayed per row, but not as per your screenshot.
(I think below given is not a great idea, but we can try that).
I guess, to display as per your screenshot take 3 different tables, place them side-by-side and write filter conditions such that to hide some rows in table1(Ex. Display row no.'s in "table1" 1,4,7,10), display some rows in table2(2,5,8,11) and in Table3(3,6,9,12) as described in this answer about faking multiple columns with tables.
Use below expressions for 3 Tables:
Table1
=iif((RunningValue(Fields!TypeMaterial.Value ,CountDistinct,Nothing) Mod
2) <> 0 AND (RunningValue(Fields!TypeMaterial.Value ,CountDistinct,Nothing) Mod
3) <> 0, False, True)
Table2
=iif((RunningValue(Fields!TypeMaterial.Value ,CountDistinct,Nothing) Mod
2) = 0, False, True)
Table3
=iif((RunningValue(Fields!TypeMaterial.Value ,CountDistinct,Nothing) Mod
3) = 0, False, True)
Related
Praat scripting noobie here. I'm expanding on a pre-existing piece of code right now, and it produces a bunch of tables based on a set of sound data, and here's a couple examples of what they look like when pasted into Excel:
As you can see, there are labels ascribed to different points in each sound file, and the most important ones are '%,' 'H,' & 'L'. I want to copy data from the 'tone_height' column into separate tables - 'H' tone heights in a separate 'H' table, 'L' tone heights in a separate 'L' table and so forth. Problem is, because the number of %, H, and L values are not consistent across the sound files, I'm having trouble writing an algorithm that loops through all these tables and picks up JUST the H data, for instance. This is the code I have so far:
Read TableOfReal from headerless spreadsheet file... 'directory$''name$'.means
nrows = Get number of rows
ncolumns = Get number of columns
tone_row = 0
for n from 1 to nrows
tone_height = Get value... n 12
if tone_height > 0
rowname$ = Get row label... n
Select columns where row: "5", "self[row,0] = 'H'"
endif
I was trying to tell Praat to copy column 5, and only copy the elements where the string in column 0 is 'H.' But this doesn't seem to be working - am I missing an extra step or extra conditions?
Once selected your table in Praat, try this:
Extract rows where column (text): "rowLabel", "is equal to", "H"
In the only row group I am trying to get a alternate row color with the following expression:
Expression for background color : =IIf( RunningValue (Fields!SP.Value, CountDistinct, Nothing) MOD 2, "White", "blue")
SQL code:
select
ROW_NUMBER() OVER (ORDER BY DataDate) AS SSRSRowNumber
,datepart(dw,datadate) SSRSDateFilter
,DataDate
,SP
,sum(TMI) as TotalCI
from table
where DataDate>GETDATE()-20
group by DataDate,SP
order by 1, 2
The result is the picture below, what's wrong in the expression listed above?
Edit-:Solution
The missing dates in your data is causing the issues with the background row color not working correctly.
You can waste lots of time trying to make your query work.
Or you could just use the Alternating Row Color function.
Private bOddRow As Boolean
'*************************************************************************
' -- Display green-bar type color banding in detail rows
' -- Call from BackGroundColor property of all detail row textboxes
' -- Set Toggle True for first item, False for others.
'*************************************************************************
Function AlternateColor(ByVal OddColor As String, _
ByVal EvenColor As String, ByVal Toggle As Boolean) As String
If Toggle Then bOddRow = Not bOddRow
If bOddRow Then
Return OddColor
Else
Return EvenColor
End If
End Function
For the first column that controls the color:
=Code.AlternateColor("AliceBlue", "White", True)
For the remaining columns, don't toggle with the third argument:
=Code.AlternateColor("AliceBlue", "White", False)
You may need to switch the colors in the first column in a matrix.
SSRS Alternating row color issues when some rows are not visible
This has occurred for me where I don't have an intersection between my row groups and column groups.
Example:
- I have stored procedures 1 and 2
On 1/1, both 1 and 2 ran, so I record them
On 1/2, only 1 need to run, so I only record 1
On 1/3, they both ran again, so I recorded both
I'm going to have a messed up looking cell on 1/2 for sp 2 (the color won't change) because SSRS can't calculate a new value for the running total (it's still 1). On 3, it recognizes a value and gets that the running value is now 3, so coloring resumes as expected.
To solve this, you could perform a cross apply to get the cartesian product of all dates and SPs so that every distinct date has a row for every distinct date and store this in a temp table. Store your current query in a temp table or CSV and join onto your cross apply based query. This will ensure no missed cells. Note, this will have a performance impact so test accordingly (it is most likely negligible).
Let me know if you need help writing the queries.
I try to put in SSRS in a chart bar a target line and a baseline. I add in my chart with stripline a target line. But I would like to show it like this:
The chart1 is the chart which I would create in SSRS. And the chart2 is the chart which I create in SSRS. How can I add only one bar at the beginning of the chart.
I assume there is a parameter or equivalent identifying where the Baseline should be (even if it is the current date)
If so, you can have the baseline series to only display a value for the column you want to set as the baseline.
In this example I have a number of students, and want to display a baseline column where the student name is Student1
Add a new series to the chart, and set the expression to be
=iif(Fields!Student.Value = "Student1", Sum(Fields!Val.Value), 0)
This will mean that it will only return a value when the column is for Student1, otherwise it will return zero.
Conversely, you could set the other columns to be values except for when they are Student1 as follows
=iif(Fields!Student.Value <> "Student1", Sum(Fields!Val.Value), 0)
Using a Stacked Column chart for these series would give this output
Alternatively, you could use dates for the X axis, and use a parameter to set the date for the baseline, and use a expression such as this to identify the baseline column
=iif(Fields!myXAxisDate.Value = Parameters!myBaselineDate.Value, Sum(Fields!mYValue.Value), 0)
Hopefully this will assist you. Please let me know if you have further questions on this.
I'm making an addon for word. It must be possible to insert tables. It shall be possible to specify the dimensions and location. When I insert the first table it works fine, but if I insert another table, then the first table get removed and the new one inserted. I am still pretty new to vb.net so, the code may not be the best.
With Globals.WordAddIn.ActiveDocument.Tables.Add(Globals.WordAddIn.ActiveDocument.Range, 1, 1)
.TopPadding = 0
.BottomPadding = 0
.LeftPadding = 0
.RightPadding = 0
.Rows.WrapAroundText = True
.Rows.RelativeHorizontalPosition = Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionPage
.Rows.RelativeVerticalPosition = Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionPage
.Rows.HorizontalPosition = dobHorizontal
.Rows.VerticalPosition = dobVertical
.Rows.Height = dobHeight
.Columns.Width = dobWidth
End With
Assuming you're using the code above for adding both tables (possibly in a loop) I think the issue is that you're overwriting the first table with the second one since you use the same range.
The documentation for Tables.Add says:
The range where you want the table to appear. The table replaces the
range, if the range isn't collapsed.
If you change the first line of your code from:
With Globals.WordAddIn.ActiveDocument.Tables.Add(Globals.WordAddIn.ActiveDocument.Range, 1, 1)
to something like
dim range = Globals.WordAddIn.ActiveDocument.Range;
With Globals.WordAddIn.ActiveDocument.Tables.Add(range, 1, 1)
And then after you added your first table you do:
range.Collapse(Word.WdCollapseDirection.wdCollapseEnd);
It should let you add both tables.
However, if you add two tables right after each other I think Word combines them into one table, so you need to add some space in between, for example by using something like:
range.InsertParagraphAfter();
range.Collapse(Word.WdCollapseDirection.wdCollapseEnd); ' need to collapse again to avoid overwriting
I think it might work.
I know this may sound trivial but I just can't find an answer to it.
I have a rdlc report in which I like to alternate row background color and for this I've used the following formula:
=iif(RowNumber(Nothing) Mod 2, "#e5e5e5", "White")
I also need to hide some rows and for this I use the following formula:
= Fields!MeanAeb.Value <> ""
where MeanAeb is a field in my report. My problem is that rowNumber also counts the hidden rows, so my table may have two consecutive rows with the same background. is there a way to take only visible rows into account?
So if anyone has the same problem, I have an answer;
in the Code section of your ReportProperties add the following
Dim customRowNumber as Integer = 0
Dim previousRowNumber as integer = 0
Function CustomRowCounter(conditionToTest as Boolean, rowNumbner as Integer) as Integer
if(conditionToTest and rowNumbner <> previousRowNumber)
customRowNumber = customRowNumber + 1
previousRowNumber = rowNumbner
end if
return customRowNumber
End Function
then on the background field in your column properties add this condition:
=iif(Code.CustomRowCounter(Fields!MeanAeb.Value="",RowNumber(nothing)) Mod 2, "#e5e5e5", "White")
this is nice because you can add any condition you like in place of Fields!MeanAeb.Value="". Just remember to use the inverse of the condition in your rowVisibility field, otherwise you may cause strange effects.
Oh and if you want a chess board look to your report just drop the previousRowNumber :)