In SSRS, how to include first row from different dataset in tablix? - reporting-services

I am creating a report, the purpose of which is to print a letter to many different people. Obviously each person's name, email, etc. will be different. For this I am using a list, which I understand uses a tablix.
Now inside each letter I also need some global data that comes from a dataset. For example, the company email, telephone number, etc. This data will be the same for every letter. However, every time I try to use some expression to get this, I get an error such as:
The Value expression for the text box ‘Textbox11’ refers to the
field ‘URL’. Report item expressions can only refer to fields within
the current dataset scope or, if inside an aggregate, the specified
dataset scope. Letters in the names of fields must use the correct
case.
The expression I'm using to get the above error is
=LookupSet(true, true, Fields!URL, "SystemVars")
I've tried other things but I can't figure out what I need to make it word.
Is there an expression I can use to solve this problem? If not, what steps should I take to get my letters working?

You are missing the ".Value" portion in the expression. Try this:
=First(Fields!URL.Value, "SystemVars")

Related

MS Access Expression That Includes Dynamic Field Names

I have a crosstab query which returns results based on consumer demand for a bunch of material numbers. The material numbers become my field names in the crosstab query, and later the values from those fields are displayed in a form.
In the form, I display the value in a textbox. There are a couple of these textboxes where I need to sum the total of two or more values from these fields. Not a big deal it's a simple expression. For example (in the Control Source property): =[H123457] + [H123456].
This works well UNTIL there is no demand for a particular material number. In this case, the field doesn't show up in the crosstab query and I'm left trying to sum two fields where one doesn't exist.
I've tried IIf(IsError([H123456]), 0, [H123456]), Null expressions, Nz function, etc but cannot figure out how to dynamically solve the #Name issue that ends up populating the text box.
Essentially what I want is for a 0 value for the field that doesn't exist, so I can add it to the value where the field DOES exist - is this possible?
Regards!
June7 provided the answer in the allenbrowne.com link. Essentially, you need to add all of the possible field names to the Column Headings property in the crosstab query property window. Then it's a simple matter of adding an Nz() function to handle null values.
Thanks June7!

Display Parameter in SSRS Report

When a user runs the report, they can select a multi-value parameter. I know I can use Parameters!Value.Label(0), Parameters!Value.Label(1), etc to display the each of the values based on their location within the array, but the number of the values changes based on how many values the user selects.
The report separates each value onto a separate page. I'm looking to (a) have an expression that identifies which value's info is displayed on the page, and (b) an expression that labels the tab as the value when the report is exported to Excel. I expect the same expression would work for both.
I believe I should be using Array.IndexOf(Split(Parameters!Value.Label.ToString(), ","), Parameters!Client.Label), but just get #Error as the output when the report renders. I'm not sure, but it seems like the Array... expression would only identify the location within the array.
Could someone offer some insight into where the syntax is wrong? I'm not sure if the issue is syntax or it's an issue of how to specify which dataset to use in the expression.
Thanks.
This is what you should use
=Join(Parameters!CSR.Label, ", ")

LookUp not matching properly

So, I have a problem in Report Builder that is just driving me absolutely crazy.
I have two dataset; one called DS_Grades and the other DS_Pupils. I want to do a simple LookUp based on PupilID, a field that is in both datasets, and return a grade from DS_Grades into a Matrix based on DS_Pupils.
The formula I am using is:
=LookUp(Fields!PupilID.Value, Fields!PupilID.Value, Fields!Grade.Value, "DS_Grades")
I have confirmed that:
1) DS_Grades has the right PupilIds
2) There are actually values in the Grades field
3) Both PupilID fields (I.E. in both datasets) are definitely Integers and not text.
Moreover, if I add a calculated field to DS_Grades called "test" and populated with the value 208301, which is a valid PupilID, then I can enter the below formula and it works fine:
=LookUp(208301, Fields!test.Value, Fields!Grade.Value, "DS_Grades")
So, the LookUp itself must be matching properly, which means that the PupilID fields must be causing the problem, but I have quintuple freaking checked them and they definitely have the right values, in the right format. I am at a total loss as to why SSRS thinks that they don't match.
Help please!
Got it! Some filtering was at Dataset Level (instead of query where I normally do it) that was throwing the whole thing out of joint. Removed that, and it's fine.

SSRS Filter with a different column from a different dataset

I want to filter my column, let's call it AllStudentID from dataset1 with another column from a different datset.
Dataset1 had many column such as AllStudentID, Class, Time, Location.
Dataset2 has other columns but i'm focused on a similar column called OnCampusID.
I've tried looking into using a filter but since the report itself has the columns from Dataset1, i run into an issue where if I select the column in dataset2, it always gives a First(OnCampusID). And I don't want that.
I looked into IIF() but again, i'm using a column from a different datset plus if let's say that they are NOT equal, I don't want to display anything, instead of putting something there. I know that you have to put a result if true and a result if false.
If I"m thinking of it in terms of SQL statements, it's like having a WHERE clause WHERE AllStudentID=OnCampusID.
I tried running a Parameter but I don't want the select part on the top but rather have the report filtered already.
Am I missing something? I know it has to be simple.
Mind you, the following example above is just an example i made up, not the real thing.
Assuming that each OnCampusID only appears once in Dataset2 then you can do a Lookup expression to filter it:
=IIF(IsNothing(Lookup(Fields!AllStudentID.Value, Fields!OnCampusID.Value, Fields!OnCampusID.Value, "Dataset2")), False, True)
If OnCampusID appears more than once in Dataset2 then do the same thing using LookupSet.
To get the graduate field from Dataset2 just to a Lookup in the Value of the cell, like so:
=Lookup(Fields!AllStudentID.Value, Fields!OnCampusID.Value, Fields!Graduate.Value, "Dataset2")

Use a summary field in an expression in SSRS reports

I have the details of my report being summed up in a summary expression, all works fine. The fields are decimal values of hours worked. Thus, the summary value is also a decimal value. I'd like to access the summary value and convert it to hours / minutes. I've labeled the express as "WorkTimeSum", but can't seem to get a handle to it, however. Fields! obviously won't work since it is a summary expression. I was thinking ReportItems! should work, but to no avail. How can I use this expression field (in a summary row) in an expression in the same summary row?
If I've understood correctly, you're asking how to reference the textbox containing the total work hours value so that you can convert it to hours and minutes using an expression in a different textbox?
You can use either ReportItems! e.g.
=ReportItems!Textbox20.Value)
or ReportItems("") e.g.
=ReportItems("Textbox20").Value
to reference the value of another textbox. Be careful with the names as they are case sensitive.
You can use aggregate functions in any expression. For example, in any header rows you can use the following expression to determine the total hours value:
=Floor(Sum(Fields!hours.Value))
Sum(Fields!hours.Value) is just the total hours in whatever context, e.g. the group total if it's a group header row; you can use this expression as an input in any other expression you require.
It sounds like your issue wasn't the conversion itself, so hopefully this points you in the right direction. If you need further information please specify.