SSRS:Use decimal place in expression - reporting-services

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.

Related

Changing text to show radio buttons and checkboxes but some rows show #Error

I have a form which users are filling out and I don't have much control over the format that the data is in so it all appears in a single table with an ID and a Value column.
In the form there are checkboxes and radio buttons so some of the values are "True", "False", or the radio button ID from the form.
On my report I'm then trying to use an expression to turn the text back into a checkbox or radio button. I have all of the elements working individually but some other part of the data always returns #Error which I assumed was because it didn't fit into my expression.
I've now combined the expression into one which is below and I still get #Error on some of the fields. The result at the moment is that the checkboxes are shown and numerical values are shown but anything else whether it's just plain text or the radio buttons doesn't show.
=IIF(Fields!value.Value = "Tested", Chrw(9673) & "Tested " & Chrw(9675) & " Failed " & Chrw(9675) & " N/A", IIF(Fields!value.Value = "Failed", Chrw(9675) & "Tested " & Chrw(9673) & " Failed " & Chrw(9675) & " N/A", IIF(Fields!value.Value = "N/A", Chrw(9675) & "Tested " & Chrw(9675) & " Failed " & Chrw(9673) & " N/A", IIF(Fields!type.Value = "checkbox", IIF(Fields!value.Value = True, ChrW(&H2611), ChrW(&H2610)), Fields!value.Value))))
I think it may be because I end up with different text fonts and formats required on the same textbox but I'm not sure how to establish that for certain and then also come up with a solution.
The screenshot below is my output with the top block of #Error's being ones that should show as radio buttons and the 2 on their own further down are just plain text.
SSRS Output
In your final IIF you are testing Fields!value.Value against True but it would appear that you value field is text so that might not give expected results.
try changing the final
IIF(Fields!value.Value = True, ChrW(&H2611), ChrW(&H2610)), Fields!value.Value)
to
IIF(Fields!value.Value = "True", ChrW(&H2611), ChrW(&H2610)), Fields!value.Value)
If this does not help, then can you edit your question and show some sample data that is in your value and type fields, then show what you are getting now and what you expect to see. At the moment it's difficult to understand which values are working and which are not.

MathJax - aligned equations with id or class

This is my first post here, so I hope everything is clear enough to understand.
I have a list of equations (written in LaTeX), which are alligned like this:
LaTeX example
With following code:
\begin{array}{rcll}
\textrm{gravitational acceleration} & \qquad g & = & \dfrac{G\cdot M}{R^2} \\
\textrm{gravitational acceleration - latitude}: & \qquad g & = & g_{45} - \dfrac{1}{2}\left(g_{poles}-g_{equator}\right)\cos\left(2\varphi\cdot\dfrac{\pi}{180}\right) \\
\textrm{gravitational acceleration - altitude}: & \qquad g_h & = & \dfrac{G\cdot M}{\left(R + h\right)^2} = g_0 \left(\dfrac{R}{R + h}\right)^2 \\
\textrm{arc length}: & \qquad s & = & r\theta \\
\end{array}
The next thing I want to do is that when I click on an equation I get a dropdown with more information or that I go to a page with information of that equation.
But to do this, I think I need some kind of ID of the equation to know which one is clicked and needs extra information.
I hope everything is clear and thanks in advance.

format lookupset expression

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

Two different formats of field in report Access 2013

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

Filter for Text with spaces

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!