In Report Builder, I have an expression using the lookupset function that pulls back either nothing, a date and description, or several dates and several descriptions. The data it is pulling is correct. I have searched this forum and MSDN. Using what I've found in both places, I have tweaked my expression to the following.
My expression:
=Join(Lookupset(Fields!ProjectName.Value,
Fields!ProjectNames.Value,
Fields!TaskBaseline0FinishDate.Value & " - " & Fields!TaskName.Value,
"DsActivitiesCompleted"))
However, when this is displayed it doesn't have a carriage return, it just puts one after another after another. Example Below:
08/05/2015 – Milestone: Kickoff meeting Complete 08/18/2015 – Milestone: PMT Test Planning Complete 08/26/2015 – Milestone: Set CCD Date 08/26/2015 – Sprint 0 Complete 09/18/2015 – Milestone: Wave 1 Complete 09/28/2015 - Milestone: Wave 2 Complete
What I want it to look like is below. If possible I would like to have bullet points in front of each line as well.
My question is how do I get it in the format above?
Thanks,
MM
You have missed the final (optional) argument of JOIN which states which character you want to use to join your string together. Changing your expression tyo use vbCrLf (the VB new line code) as follows
=Join(Lookupset(Fields!ProjectName.Value,
Fields!ProjectNames.Value,
Fields!TaskBaseline0FinishDate.Value & " - " & Fields!TaskName.Value,
"DsActivitiesCompleted"),
vbCrLf)
Gives this output
Update
Use the below to use Chr(183) as a bullet character for each new line as well
=" " + Chr(183) + " " +
Join(Lookupset(Fields!ProjectName.Value,
Fields!ProjectNames.Value,
Fields!TaskBaseline0FinishDate.Value & " - " & Fields!TaskName.Value,
"DsActivitiesCompleted"),
vbCrLf + " " + Chr(183) + " ")
Related
I have a data table that looks like the below. This shows the top 3 subcallcategories based on the amount of calls. The "order" column is a row number that shows which order the subcallcategory was in based on the calls.
I am trying to write some DAX in SSRS which displays the following
Anxiety was the most common counselling call, followed by Work Related
Stress and Bereavement
I have written the below code however it doesn't seem to be picking up the last 2 categories? Anyone have any ideas what I am doing wrong?
=IIf(Fields!Order.Value = "1" and Fields!Category.Value = "Counselling", Fields!SubCallCategory.Value, "") &
" was the most common counselling call, followed by " &
IIf(Fields!Order.Value = "2" and Fields!Category.Value = "Counselling", Fields!SubCallCategory.Value, "") &
" and " & IIf(Fields!Order.Value = "3" and Fields!Category.Value = "Counselling", Fields!SubCallCategory.Value, "")
Below is my current output
As Alan mentioned, your expression is just looking at a single row of data.
You would need to put this expression in a table with Grouping by Category.
Then you would look for the ones in your ORDER and use that Sub Cat value. I use MAX and NULL to get matching values like
=MAX(IIf(Fields!Order.Value = 1, Fields!SubCallCategory.Value, NOTHING)) &
" was the most common " & Fields!Category.Value & " call, followed by " &
MAX(IIf(Fields!Order.Value = 2, Fields!SubCallCategory.Value, NOTHING)) &
" and " & MAX(IIf(Fields!Order.Value = 3, Fields!SubCallCategory.Value, NOTHING))
The MAX will get the SubCat value over NOTHING (SSRS for NULL) for the ones in the right ORDER.
This would give one line for Counselling and one for Legal.
You could also add the totals in with
MAX(IIf(Fields!Order.Value = 1, Fields!Calls.Value, 0))
I assume your ORDER field is an INTEGER and doesn't need the quotes.
I would like to minimize the decimal place in my report.
my expression:
="On: "& Avg(Fields!System.Value) & " OFF: " & avg(Sum(Fields!A1.Value)/Sum(Fields!A2.Value)*100)
I would like to show no decimal place for ON and one deciaml place for OFF.
I tried it with the function of ssrs but that is not possible.
How can I do this in this expression?
Try:
="On: "& FORMAT(Avg(Fields!System.Value),"N2") & " OFF: " & FORMAT(avg(Sum(Fields!A1.Value)/Sum(Fields!A2.Value)*100),"N2")
In "Nx" replace x by the number of decimals you want to show.
Let me know if this helps.
I'm trying to find a way to do the following:
I want to have two different formats for a certain text box. To do so, I've done the following: User types one or two digits in a form text box(who's input and format are both "#,0;0;_") and has "yes/no" box on the right of that number field which asks if it's "kg per bag"(so by default it's the other measurement unit which is Percentages), then an OnLoad event is fired when viewing the report for that form, which checks if the yes/no value is yes or no. If "yes" then the format is set to "#.0 & " kg/bag"", if no it's set to "#.0 & " %"".
I will have to additionally divide by 100 when percentages are the ones picked, but first I want the whole thing to work... Which I still can't do!
Sadly, I'm nowhere near getting it to work... Here is my current macro on the onload event of the report, which is marked as not valid expression:
Link to the image on Imgur
Or here is the MacroBuilder Code:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<UserInterfaceMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><UserInterfaceMacro For="Report" Event="OnLoad"><Statements><ConditionalBlock><If><Condition>[yn]=False</Condition><Statements><Action Name="SetValue"><Argument Name="Item">[Text0].[Format]</Argument><Argument Name="Expression">#,0 & " kg/bag"</Argument></Action></Statements></If><Else><Statements><Action Name="SetValue"><Argument Name="Item">[Text0].[Format]</Argument><Argument Name="Expression">#,0 & " %"</Argument></Action></Statements></Else></ConditionalBlock></Statements></UserInterfaceMacro></UserInterfaceMacros>
Which is displayed as:
If [yn]=False Then
SetValue
Item = [text0].[format]
Expression = #,0 & " kg/bag"
Else
SetValue
Item = [text0].[format]
Expression = #,0 & " %"
End if
Can anyone give me a hint on where to go with this? Thank you!!
P.S. Comma is my decimal separator in regional settings!
You don't really need to change format only concatenate the numeric value with unit (kg/bag or %).
Using VBA, try the following code in the OnLoad event (I am assuming the recordsource field behind the text0 control is called the same -text0):
If Forms!yourformname![yn] = False Then
Reports!yourreportname!text0 = Me.text0 & " kg/bag"
Else
Reports!yourreportname!text0 = (Me.text0)/100 & "%"
' ALTERNATIVELY: Reports!yourreportname!text0.Format = "percent"
End If
Alternatively in the OnLoad event, use an embedded macro or call an external macro with the following one action (if/then changed into the IIF function):
SetValue
Item: text0
Expression: =IIF(Forms!yourformname![yn] = False, text0 & " kg/bag", text0/100 & "%")
I am writing an SSRS report in which my client wants the report header to contain the criteria on which the report is based (actually, this is the report variables, such as date).
I tried to do this with textboxes, but can't seem to position the textboxes in such a way that upon export to excel there aren't crazy cell merges.
I also tried to do this with a table in the report body, but got the variable added to each line of the report.
I don't see a position property, as if I was working in just a web form, but am at a loss as to what to do. Any suggestions? Thanks!
Cell merges are a fact of life when exporting to Excel unfortunately, that's how the report rendering engine tries to maintain fidelity with the original report design. The best way to minimise this is to ensure the edges of the report elements align with each other as much as possible, so that the renderer can align the report without having to merge cells.
What you are doing by putting textboxes in the report header to display the value of selected report parameters is a good approach that is commonly used, so keep experimenting with the layout to get it to align correctly.
If you can describe what is happening when you export the report in a bit more detail I might be able to offer some more advice.
In my reports, I add an additional table at the end of the report and assign a page break before the tablix. In the large, single-cell table, I write sentences using quoted text, built-in fields, and parameter values to list all of the parameter information. I label the Name of the Tablix "Parameters" so when the report is downloaded, all of the parameter data goes with it in a nice, non-invasive format. When troubleshooting reports this has proved very valuable.
Here's an example:
=Globals!ReportName + " run by " + User!UserID + " on " + FormatDateTime(Globals!ExecutionTime, DateFormat.ShortDate) + ". "
+ vbcrlf +
"Parameters: " + "Program ("+Parameters!BusinessEntityID.Label+ "), Deliverable Status Code (" + Join(Parameters!DeliverableStatusCode.Label, ", ") +
"), Science Area (" + Parameters!ScienceAreaID.Label + "), Thrust Area (" + Parameters!ThrustAreaID.Label + "), Center (" + Parameters!CenterID.Label + ") "
+ IIF(Parameters!TaskActiveFrom.Value is Nothing, "", ", Tasks Active between "+ FormatDateTime(Parameters!TaskActiveFrom.Label, DateFormat.ShortDate)
+ " and " + FormatDateTime(Parameters!TaskActiveTo.Label, DateFormat.ShortDate))
+IIF(Parameters!TaskStartFrom.Value is Nothing, "", ", Tasks Started between " + FormatDateTime(Parameters!TaskStartFrom.Label, DateFormat.ShortDate)
+ " and " + FormatDateTime(Parameters!TaskStartTo.Label, Dateformat.ShortDate))
+ IIF(Parameters!DeliverablePlannedFrom.Value is NOTHING, "", ", Deliverable Due Date between " + FormatDateTime(Parameters!DeliverablePlannedFrom.Label, Dateformat.ShortDate)
+ " and " + FormatDateTime(Parameters!DeliverablePlannedTo.Label, Dateformat.ShortDate))
+ IIF(Parameters!DeliverableExtendedFrom.Value is Nothing, "", ", Deliverable Revised Due Date between " + FormatDateTime(Parameters!DeliverableExtendedFrom.Label, Dateformat.ShortDate)
+ " and " + FormatDateTime(Parameters!DeliverableExtendedTo.Label, Dateformat.ShortDate))
+ IIF(Parameters!PublicationReceivedDateFrom.Value is NOTHING, "", ", Publication Received Date between " + FormatDateTime(Parameters!PublicationReceivedDateFrom.Label, Dateformat.ShortDate)
+ " and " + FormatDateTime(Parameters!PublicationReceivedDateFrom.Label, Dateformat.ShortDate))
Using Microsoft Access I want to set a filter for records which include spaces. I tried double escaping by using '""' to no avail.
I have a table like so:
ID Title
1 Green
2 Blue Yacht
3 Yellow
and a form just displaying these records. When I now set the filter:
Form.Filter = "TestTable.Title LIKE '*Yellow*'"
it works like a charm. But when trying to filter for "Blue Yacht"
Form.Filter = "TestTable.Title LIKE '*Blue Yacht*'"
I get an empty result. Filtering for just Blue works like it is supposed to. Somehow Access doesn't like the spaces in the filter. How can I filter for e.g. "Blue " or "Blue Yacht"?
That's very strange behaviour, it should work fine as is, you could try using the Chr code instead of the space:
Form.Filter = "TestTable.Title LIKE '*Blue" & Chr(32) & "Yacht*'"
I stumbled upon this old thread while searching a solution for the same problem. I found none so far. I wonder if this is a bug on Access or what.
So, this is my case, I tried both filters below. I was working to filter and populate a Datasheet subform. Filters are in Combo Box: Citrate, Paxgene, Sodium Herapin.
Dim sTType as string
...
...
1. sTType = "[Tube Type] LIKE '" & Me.txtTubeType & "*'"
2. sTType = "[Tube Type] ='" & Me.txtTubeType & "'"
...
me.Filter = sTType
When Sodium Herapin is selected and applied as filter , the filter comes up with nothing, while I've no problem with the other word filters.
Sol.: I inserted this code way up
me.txtTubeType = iif(InStr(Trim(Me.txtTubeType), "Sod") > 0, "Sodium*", me.txtTubeType)
...
...
sTType = "[Tube Type] LIKE '" & Me.txtTubeType & "'"
me.Filter = sTType
The work around is kind of crude but it worked for my situation.
Cheers!