Removing parts of a field in SSRS reports - reporting-services

I have a question that I need help with :
I also need to extract the last two digits of the year and put in a text box using an expression. for eg, since we are in 2022, I need to extract the last two digits (22).
grateful if someone can please help as I have not done this before and my syntax might be off
I have tried :
=DatePart(Year())-2
thank you

Related

SSRS Format Number Separator

I have a field in SSRS that returns the value of numbers varying from ## to #######. I want these numbers to be separated by thousands. I have seen a few posts saying you could use this:
=Format(Fields!Number.Value,"#,#.##")
However, I have this textbox to display data from a different dataset, like:
=First(Fields!Price.Value, "DataSet3")
Now, the question is how do I combine both? Is it possible to wrap it like this:
=Format(First(Fields!Price.Value, "DataSet3"),"#,#.##")
If I do this and run the report then the output on the text field is just #,#.## and not the actual number itself.
Input: 100000000
Output that I expect: 100,000,000
Output that I get: #,#.##
Any help is much appreciated. Thanks!
This is definitely some weird functionality. I didn't figure out exactly what was causing it, but I found that adding a datatype cast to the expression resolved the issue.
=FORMAT(CDec(First(Fields!XYZColumn.Value, "ZYXTable")), "#,#.##")

SSRS - Expression to replace all but last four characters?

Apologies in advance if question is too basic. I searched but couldn't find anything specifically applicable to reporting services.
I'm working on a report that's currently returning the full value that's being queried.
Currently, the expression for that text field is
=Fields!VarName.Value
What I'm looking to do is return only the last four with a set of *s to represent whatever the preceding digits are. Even though the number of digits is going to vary, it's not important that I match digit for digit, so I'm fine with just inserting a set number of *s and then the last four. I figured this would be easier. I've tried this:
="*****" & Right(Fields!VarName.Value,4)
That returns the stars, but not the actual values. Am I just completely off the mark on how to get those last four numbers?
"Right(RTRIM(Fields!VarName.Value),4)" Was the correct answer.

Weird SSRS Format Date Output in Header

For one of my Matrix reports, the column headers are Dates which I am trying to format in the form of 'Mon 07' i.e. short date name followed by date value.
For this I am using the expression - =Format(CDate(Fields!WorkedOnDate.Value),"ddd")
I then wanted to trim the right 3 letters.
I am getting weird output.
Here is what I am getting for one week-
Tue, We2, T12u,ri,SaA,Sun,7on
Any idea what is going wrong?
This was asked in this link but that answer didn't help -
The date formats do not seem to work in SSRS
I realize my mistake now. I was adding the Format property across Number-> Format property of that textbox. I solved this by adding as part of the textbox Property value.

SSRS-Reports formatting

I am having a few issues using SSRS-Reports 2005.
The first one is I am trying to use the datediff function to change the background color of a cell based on the two dates being within 30 days of each other.
=iif(
DateDiff("d",DateString,Fields!Insurance_Certificate.Value)<= 30, "Tan", "White"
)
I have my fields formatted through the initial query so they look like mm/dd/yyyy. I guess my first question is how do I see what value is being evaluated because whatever this is returning can't be right.
my [...] question is how do I see what value is being evaluated
There is no real "debugger" available like you would have in -say- a WinForms C# app. Instead, you have several "raw" "debugging" options:
Render Fields!Insureance_Certificate.Value in a seperate cell, as text
Render DateDiff("d",DateString,Fields!Insurance_Certificate.Value) in a seperate cell, as text
Right-click your dataset, select "Query...", and execute the query manually. Inspect the values for your field. Make sure they're what you'd expect.
Render your DateString in a seperate cell, with and without a cast to a date.
Other than that #MarkBannister has a great suggestion, using actual Dates as opposed to strings for your fields and variables. One additional thing to note about this, is that date parsing may be culture-specific. Be sure you understand and know in what culture your DateString is being parsed. The above "debugging" options may help you find out.
I suggest querying your date fields as dates (instead of as strings), comparing them using the DateDiff function as in the question and formatting the date output using the Format property of the appropriate textboxes in SSRS.

Access 2007 - Using results of an equation inside another equation on a report

I inserted three text boxes to test how this could work:
Text81: =1
Text82: =2
Text83: I want this one to be the sum of Text81 and Text82
Thanks in advance for your help on what I think is a pretty simple problem.
There are a couple options that spring to mind.
First you could always modify the data source for the report to include the calculated field.
Second, which is what your question drives at, you can do something like this:
=[Text81] + [Text82]
Should work when typed into the Control Source of a TextBox provided Text81 and Text82 are the data field names from the Data Source of the Report. If they are not you would put the corresponding data field names in the square brackets []
Hope this helps