Missing field formatting - reporting-services

I am having some trouble getting around missing fields in my report designing.
Many of the users on the database have a missing Address Line 2.
The report is being rendered using list items like this:
Name
Address 1
Address 2
Town
Postcode
So if Add2 is missing it appears like so:
Name
Address1
Town
Postcode
Is this possible using lists within Report Builder 3?
See attached image.

My recommendation would be to use row visibility to hide rows where the corresponding field is empty or missing. I don't know whether your data has "" or NULL behind the scenes so this is generic advice.
Here is a great set of examples of the types of formulae you can use:
http://msdn.microsoft.com/en-us/library/ms157328.aspx
If the field is NULL you can use the is nothing evaluator like
=(Fields!Sales.Value is NOTHING) to return a TRUE or FALSE, alternatively you can do a check of the string length using the function LEN() to see how long it is and if it is 0, hide the row.

Related

How can I find a specific value in an object?

I have a Parameters that is an object and contains a few value :
key
Value
0
Apple
1
Juice
2
Banana
So If I do Parameters!MyParam.Value(0) the result is Apple, and Parameters!MyParam.Value(1) the result is Juice, etc.
What I want to do is to see if my object contains a value like Banana and return true if it does.
Is it possible ? I didn't find anything the net. The closest thing that I found is inStr but it only works for strings...
A few things to point out here...
In SSRS a parameter is made up of a Value and a Label. What you describe as the Key would be the Value and what you describe as the Value would be the Label.
You can reference the Parameter's Label property using Parameters!MyParam.Label
It's not clear from your question but I assume you want to search your parameters to see if a specific value has been selected. If so then you can do that like this...
For this exmaple I have added the parameters values/labels manually but you can do this however you need.
Next I added, for demonstration purposes, some labels and fields to the report as follows.
The selected parameter's expression is
="|" & JOIN(Parameters!MyParam.Label, "|") & "|"
The 'contains banana' expression is
=("|" & JOIN(Parameters!MyParam.Label, "|") & "|").Contains("|Banana|")
The JOIN simply joins all the selected parameter labels togther, using the pipe symbol | as a delimiter. I then add a | to the start and end so the can search for |searchterm|. This avoids errors if, for example, you had "Pineapple" and "apple" in the parameter list and searched for "apple", it would show true even if only "pineapple" had been selected. By searching for "|apple|" we avoid this.
Once we have the join results we can then use the VB function .Contains() to search for what we want.
If I run the report and select all values I get this
If I select only Apple and Juice I get this

How can I group data by matching identical cells in same column then counting instances of a related column?

data output
I am pretty new to Webi and am having an issue creating a variable. I'm trying to check if there is more than 1 email address for each entity legacy account number and if 1 of the contact names contains "Annual Report". So when I flag each entity legacy account number for no email only the ones without a contact name that contains "Annual Report" will be pulled. In the example above only the yellow groups should be called no email. Right now all of them are being pulled into no email. I have tried using if and match as those are what I am most familiar with. Does anyone have any suggestions?
There are number of ways you could do this. I am going to give an example using two variables, but you could easily combine them into one.
Has No Email Var=If(Match(Upper([Contact EmailAddress]); "NOEMAIL*"); 1; 0)
Annual Report Contact Name Var=If(Match(Upper([Contact Name]); "ANNUAL REPORT*"); 1; 0)
Then you would apply a report filter with two components...
Has No Email Var = 1
AND
Annual Report Contact Name Var = 0
Let me explain a few things...
The purpose of the Upper function is the Match function is case sensitive. If you know your email address are always lower case then you could remove that the Upper function and have it match on "noemail*".
It is significant that I only have a asterisk ("*") at the end of the string being sought. That will only find a match where the corresponding column value starts with that string. If you want it to be true whenever the string is found anywhere in the column being searched you would be asterisks on both ends.
You could also put limiting criteria in your query filter. But here is where thing can get confusing. Within the query filter you can choose the Matches pattern operator. However, the wildcard character is different ("%" rather than "*") and you do not put double-quotes around your search text. So you would have some thing like this...
Contact EmailAddress Matches pattern noemail%
AND
Contact Name Different from pattern Annual Report%
I am sure you noticed I didn't convert the search text to uppercase. In the Query Panel Web Intelligence is case-insensitive and would likely follow the case-sensitivity of the database of the source data. All of our databases are case-insensitive so if yours is case-sensitive you may need to play around this this a bit. Or just go with the approach of creating the variables and report filters as I initially laid out.
If you want a wildcard for a single character rather than multiple characters (which is what "*" and "%" will do) you need to use a "?" within your variable definition or a "_" in your query filter.
Hope this helps,
Noel

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

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")

Searching ALL ROWS in a Group using IIF Expression

I am working on a report that displays patient names (as groups with drilldowns) and several fields related to their visits. I have created a column in the report to display whether or not a specific value appears in the 'LocationID' column. The expression I used is
=IIF(Fields!LocationID.Value="WELL","Y","N")
I thought this was working great, it displays Y or N next to each name to let me know if 'WELL' was in their 'LocationID'. I checked several to ensure that this was going to work and discovered that there was a LocationID code of 'WHS' and since I have the rows ordered by Name and LocationID if there was a WHS visit it shows up at the top of the group and my expression is only seeing this top item. How can this expression be written differently so that it searches the entire result of each group? Depending on the date range a patient may have one visit or they may have ten. I need to check all visits that are returned. Perhaps there is a better method. Thanks in advance.
I agree with jimmy8ball that the easiest way to solve most issues like this is to push some logic back into the SQL layer.
However, if you really want to do this via SSRS functionality, then you could implement a substring search against a lookupset. Assuming you have a patient id in your dataset that is unique for each patient (I hope your group isn't on the name) then...
=Iif(InStr(Join(Lookupset(Fields!patientid.Value, Fields!patientid.Value, Fields!LocationsID.Value, "dataset"), ","), "WELL") > 0, "Y", "N")
Which says, "Search through the dataset for all rows related to my patientid, join every location into a comma deliminated string, search the string for the text "WELL" and return "Y" if it's found.
Obviously if you have locations in your dataset like "WELLY", these will become false positives and you'll have to implement some more nested logic. Try appending a value (perhaps !) to the lookupset return field so that you can search for "WELL!" or some other terminator character.

How do I split a full name field (Report Builder)

I have a name field that displays as "Mr A Test" for every record (eg. Title initial Surname)
I need to split the full name into 3 Individual fields, Title, Initial and surname.
Is anyone able to offer any assistance? I'm fairly new to Report Builder so I have already exhausted my skill base and my searches here have so far been unsuccessful.
Thanks in advance
Can you not arrange your query to provide individual fields? This would be best.
If not, one way might be to use the split function in the expression builder eg
=Split(Fields!Fullname.Value, " ")
This results in an array of strings separated by the space. You can then access each element thus
=Split(Fields!Fullname.Value, " ").GetValue(x)
where x is a zero based index