Concatenating Row Values in SSRS? - sql-server-2008

I'm trying to concatenate a particular record into one field to avoid multiple rows for the record. The issue is that a drive may contain multiple shifts in which each shift may be assigned a different vehicle.
Screenshot below shows what is happening:
Both records show the same drive, but the two shifts. I'd like to get the vehicles column to concatenate all vehicles into one field (Vehicles).
My attempt at an expression is:
=Fields!ShortDesc.Value & "," & Fields!ShortDesc.Value
Which obviously isn't working. Any suggestions on what to do to get this working correctly?

Easy solution would be to concat in database layer. See following question and answer. If you need to use SSRS solution, answer is running value function, an example here.

Related

How to customize TaxReport_IT - report SSRS?

I would like to custom the Report SSRS TaxReport_IT, I need to add a new field in order to use in to SyntethicReport Design.
(for example)
The classes involved seems these:
TaxReport_IT
TaxReportDP_IT
TaxReportController_IT
TaxReportContract_IT
Tables involved:
TmpTaxReport_ITSummary
TmpTaxReport_IT
TaxReportTmp_IT
Are there others? Are there some Queries involved?'
I added the new fields in to table _TmpTaxReport_IT_, and I pupulated the related tables
I'm sure, in to the method I pupulated correctly the new Field (I have the values ​​that I expect), but when I print the Report I get a lower value. Seems like I don't take the total data set.
How can I add the new field and take the correctly total value?
I saved the data (about my custom field in a RegularTable) and the sum is correct, but I have mismatch when I print the report.
I think I skip some step to Report DataSet.
I use Dynamics AX 2012.
Thanks in advice!
I have an idea what could be wrong, but I'm making some assumptions. If they are not correct, please edit your question to clarify.
From your screenshot, it looks like you want to add your new custom field in the header section of the report design. I'm assuming the expression of that field looks similar to
=First(Fields!MyCustomFIELD.Value, "TaxReportDS_IT")
Note the First key word in that expression. This indicates that the value for that field should be taken from the first of the records of the report's dataset.
I'm assuming that you calculate the value of the field while the records in table TaxReportTmp_IT are being created so that each record has a different value. Maybe it is a sum of some other field, so the first record would have the smallest value and the last record the highest.
If all those assumptions are correct, you can fix this by changing the First keyword to Last. This indicates that you want to take the value of the last record of the report data set.
See also the documentation of the Last Function.

Report builder 3.0 Using Reportitems!TexboxXX.Value sometimes creates multiple boxes. Why?

I have 6 Datasets each one is the same query but has a different WHERE clause based on employee type. They generate 6 tables. At the top of the report there is a summary table which uses reportitems!textboxXX.value to grab the totals for 2 particular fields from all the tables. I'm also using a StartDate and EndDate parameter. Each reportitems! expression in the table comes from a different dataset in the report if that is relevant.
When I run the report using dates from yesterday back to the 9th of May I get the desired output.
But when I go to the 8th I get multiple rows all the same.
and as I go even further back I get even more rows of the same information. To my knowledge nothing interesting or different happened on the 8th of May and the tables further down the report look exactly the same. Any idea what might be causing this? The design view looks like this if that helps. There's no grouping or filters on the table.
Still not certain about the mechanics behind this but I found a 'solution' so I figured I'd post it. I just made a new dataset for my summary tables where the query was simply SELECT 1. Now I get a single row every time.

Create an expression based off grouped rows ssrs

I want to create a single rectangle on a report that displays red if there are more then 2 distinct projects being worked on within that week (see image below):
http://imgur.com/dPHW1TT
I'd need to write some kind of expression like IIF(CountDistinct(Fields!Project_Name.Value)> 1, "Red","White") but the issue is that I need the projects to be aggregated per user.
As you can see in the above report I have it grouped on User >> Project, and thats what I'd need to captcher in this single expression.
Is there any way to specify a group in an expression?
I've actually managed to do what I wanted via filtering on the tables group, and then hiding all the cells bar one in the table.
http://imgur.com/G8IKMbS
Although if anyone knows a way to group within an expression I would still be interested in knowing.
Thanks

How to add a calculated column using conditions in a query in MS Access 2010

I have two tables and from that I am generating a query. I have columns in my query with field type yes/no. These are basically columns to determine the race of a person. The user enters information in yes/no for various races. I want another calculated column in the query which checks for all other race columns and calculates values in it.
I have to check for a few conditions in for the values in columns
For example:
1) If Hispanic is chosen, the new column should say hispanic(no matter what other options are selected. This is like a trump card)
2) If more than one is selected, then new column entry should say "multi"
3) If none of the options are selected, it should say "unknown"
4) If exactly one of them is selected, then that race should be displayed
Can anyone help me with this? I am new to Access
I can't code it for you but I can point you in the right direction. What you want to do is take all the tests you explained above and put them in a coded format :
iif ( condition, value_if_true, value_if_false )
Since you have a lot of possible outputs i'd use something like a Case Statement where you can test for all the possibilities.
Follow this link if you need any info on how to code both type of statements (iif and case).
Once you have tried something like this, you can comeback with a specific question if you encountered a problem in the process.
Good luck with your database.

How to avoid summing of numbers in report model in SQL Server Reporting Services

In a report model I have some entities which have attributes which are integers (set to integer datatype) but should not be summed or aggregated in any way.
For examples ID's.
But when I create reports with the wizard, sometimes the report builder will try to sum the values even though it doesn't make sense to sum ID's.
For example let's say I have a list of cars sold in a month. In january I've sold 2 cars, one with the ID 101 and one with the ID 210. In report builder I will then - when using the wizard - get the number 311 for the summed values. I can remove it afterwards, but I would like this to not happen at all (since the end-users will be confused)
I need a way to say to the report model: This is an integer, but it is not really a number you should sum up
Well the wizard isn't perfect as you've found out. It does it's best in trying to figure out what to do. All that you can really do is remove =Sum(carID.value, "datasetname") when it automatically puts it there. Or if you don't need to sum anything at all delete the footer of the table. A workaround perhaps would be to do a Convert in your SQL to make your ID's a varchar.
If you drag an integer field onto the table it generates a sum by default. This is not always what you want - e.g. when the field is an Id or a status code that is the same for all rows shown.
Right-click the "<<Expr>>" and bring up the "Expression..." dialog. Replace "Sum" with "First" - e.g. =Sum(carID.value, "datasetname") becomes =First(carID.value, "datasetname") If the values are the same in all rows, then the first value will do. If not, there are also other functions like Last, Min, Max.
This is a bit of a kludge, but it works for me. I used my text editor to edit the RDL (XML) file and replace "Sum(" with "", then searched (carefully) for the ")" and replaced with "". I only replaced this inside of the ... Reopen in report builder without issues.