SSRS 2012 Lookup Function Returns No Data - sql-server

I have an SSRS 2012 Report that is based on a MetricsData dataset that contains the field "REPOSITORY". The report also has a second dataset, PlanITData, containing the fields:
RepositoryName
AppName
AppOwnerName
I put an expression into one of the report columns containing the following Lookup:
=Lookup(Fields!REPOSITORY.Value,Fields!RepositoryName.Value,Fields!AppName.Value,"PlanITData")
I expected it would look up the REPOSITORY from MetricsData (the dataset that should be in the scope of the report and does, in fact, display in one of the report columns), find the matching RepositoryName from PlanITData and return the AppName from PlanITData. I get all blanks in this column. I've run the underlying query for the PlanITData dataset with known values and it returns the appropriate values. Do I not understand the Lookup function? This is my first time trying to use it...
Edit: I just saw this warning. I'd swear it wasn't there earlier. No idea what this means:
Warning 1 [rsLookupOfInvalidExpressionDataType] The Value expression
for the textrun ‘LOBGROUP.Paragraphs[0].TextRuns[0]’ uses a lookup
function with an expression that returned a data type that is not
valid for the lookup function. The data type must be an RDL Variant
type.

Apparently the expression above is correct. I kept playing with the datasets and suddenly it started working. Apparently there was an issue with how the datasets were constructed but I'm not sure what it was...

Related

How to hide columns that are not returned with dataset results using function IsMissing in SSRS

I have a stored procedure which drops either 1 or 2 columns from the result set. In my SSRS report, I have all possible columns that may come from the result set as dataset fields. I am trying to use the IsMissing function to change the column visibility, but it is not working. How can I make this functionality work?
I tried using examples from
https://sqlserverbi.blog/tag/hide-columns/
and
https://www.allaboutmssql.com/2013/01/ssrs-ismissing-visibility-function.html
where I right click the column, select Column Visibility and add an expression to the Show or hide based on an expression line.
Here is how I have been trying to use the expressions:
When I want to hide 2 of the columns I use:
=Fields!LINE_30_A.IsMissing And Fields!LINE_30_B.IsMissing
and when I want to hide only one of them I use:
=Fields!LINE_30.IsMissing
I have also tried the expressions like this:
=IIF(Fields!LINE_30_A.IsMissing And Fields!LINE_30_B.IsMissing,True,False)
I ran my stored procedure in a way that has dropped 1 of the columns from the result set. In this case the expression Fields!LINE_30.IsMissing should have been evaluated and I should be seeing the columns for Fields!LINE_30_A and Fields!LINE_30_B. But I only see the column for Fields!LINE_30 (which shouldn't be showing at all) and the other 2 columns are hidden. I also receive these 2 warnings:
1) Warning [rsErrorReadingDataSetField] The dataset ‘DataSet1’ contains a definition for the Field ‘LINE_30’. The data extension returned an error during reading the field. There is no data for the field at position 11.
2) Warning [rsMissingFieldInDataSet] The dataset ‘DataSet1’ contains a definition for the Field ‘LINE_30’. This field is missing from the returned result set from the data source.

Filter Not Working in SQL Server Report Builder

I'm attempting to create a filter on a tablix in Report Builder 3.0. I click on the Tablix, choose Properties and then click on Filters. Clicked on Add and created my filter:
Expression [SYSTEM_CODE]
Operator =
Value 1005
I don't get an error message but when I run the report, nothing is showing when I know there's valid data for that system code. It doesn't matter what value I choose, I don't see anything when I run the report. It also doesn't matter if I enclose the value in single or double quotes. There is no grouping on this report so there's no filter there either.
I'm pulling my hair out because this should fairly simple.
I had a similar issue and maybe what I found will work for you. I created a simple query to show you what I found (note the Convert statement is intentional here):
Select getdate() as "MyDate", CONVERT(Decimal(12,0), 1005) As "System_Code"
I then created a filter for the System_Code value. Note the Float value in the Type field that you cannot change.
Screen shot of disabled Type field
When I ran the report, I got this error:
The processing of FilterExpression for the tablix ‘Tablix1’ cannot be
performed. Cannot compare data of types System.Decimal and
System.Double. Please check the data type returned by the
FilterExpression.
I know, it says Decimal to Double (I blame Microsoft as this baffled me too). This is happening because this type of parameter can only process Integer and Float values. Report Builder doesn't let you change them as it infers this type from the dataset (based on my own experience). If you set the query to return an Integer, the filter will work:
Select getdate() as "MyDate", CONVERT(Integer, 1005) As "System_Code"
However, checking the Type field will still be disabled, and may show as float. Selecting another value in the drop down expression field then selecting back to the System Code value will change the Type value from Float to Integer.
The funny thing is, if you try another Convert data type value, i.e. BigInt, you will get that you cannot convert from Int64 to Float (/sigh Microsoft).
The closest I could get to seeing why this is happening, after many hours of searching, was this page on Microsoft's site which discusses that the value expected is an Integer or a Float. Even though I am not performing a Sum function, the effect appears the same.
Sum Function (Report Builder)

Parameter Values - pass a value not in the list

I have a report connected to BI cube. In the report there is a parameter with the datasat from the cube as well. This parameter correctly appears as a multi-select drown down in the report viewer, and the values are correctly populated.
However, when I am calling the report using javascript and passing the report parameters as a post request, there is an interesting behaviour.
If in the parameter, I pass a value that is not included in the list, the report crashes with the following error:
Default value or value provided for the report parameter 'Name' is not a valid value. (rsInvalidReportParameter)
Is there a way to make SSRS simply skip the invalid values rather than throw an error?
Without knowing more on what is 'acceptable' for the parameter value this question is nearly impossible to answer. In SSRS the first level of acceptance of a parameter is the type which is the common 'text' (string of equivalent in code), integer or DateTime. If you are passing a parameter to the report NOT in the format it wants it will bomb. That should be as designed.
If you limit your scope of 'available' values of a parameter by attaching the parameter to a dataset stating: "Get values from Dataset". If you give the parameter a value NOT in this collection it will also bomb. This would be the argument equivalent of selecting 6 when your choices are 1-5. And getting the standard .NET equivalent of 'argument is outside the bounds of the array.' That is also by design.
For debugging I would suggest trying to set the value in SSRS as the 'default' statically and if it can accept it then the issue is in the transfer and the type. If you can and then cannot from the web pass in via javascript or whatever method you choose it is the type being passed in. In such cases I have passed in a string and then transferred it's type in SSRS dynamically with a cast.

How to specify group in RunningValue function in SQL Server Reporting Services?

I have a data set with the following fields:
Serialnumber, Dateofpayment, Paymentamount, Sourcecode and Campaign.
My data has only two campaign types, BS12 and BS13.
I'm trying to plot a running total of the payment amount by Campaign. In the chart I have the following expression for the Y value:
=RunningValue(Fields!PAYMENTAMOUNT.Value, SUM, "Campaign")
However, I keep getting the error:
The Y expression for the chart 'Chart1' has a scope parameter that is not valid for RunningValue, RowNumber of Previous. The scope parameter must be set to a string constant that is equal to the name of a containing group within the Tablix 'Chart1'.
I've looked up multiple sources and I feel like I am doing the right thing, Campaign is clearly a field in my tablix and I have entered it as a string. Why is the error occurring? - Can someone help me?
It's complaining about the scope parameter: "Campaign". Rather than pass the column name to the function, you need to define a group (if there is not one already) on that column in your chart and pass the name of the group instead. An example here.

VB.Net - Excel application get showing values of an range

I'm trying get an Excel Range and copy into an array of objects with Vb.Net.
This is not a problem. I use the following code:
Dim vValues(,) As Object = ExcelApp.Range(vRange).Value
And works fine; but I have a the following case:
In the column "C"; the value has a specific format and internally has another value.
My question is:
Somebody know the way to get the information exact as the user see?
I'm trying to get the information without use a For ... Each or some kind of cycle.
I'm also tried to avoid use "text to columns" function.
Both seems right solutions, but would impact the performance with a lot of data.
FYI: Also I can get the information through the ODBC connection; but I'm searching the solution using a Range
Exactly what the user sees is the Text property. But you cannot have an array of that, you will have to query each cell individually.
You are getting a Double value in your array instead of a DateTime value because you have "Time" formatting applied in Excel. If you had a format from the "Date" category, Excel would instead send a proper Variant/Date, not a Double that represents it.
Another option would be constructing the DateTime objects on the .NET side, provided you know in which columns they should be.

Resources