Error in the expression rdlc - rdlc

Im getting error for the below expression in rdlc. what is causing error
=IIf(Fields!Name.Value Like "PL*","STREET INTERSECTION","STREET SEGMENT")
the requirement is the value of the text box should be dynamic depending on the item Name("Name" field). If the item Name starts with PL, this value should be "STREET INTERSECTION" if name starts with PS , this Value should be "STREET SEGMENT".

This will work for you.
SSRS supports VBA functionality rather SQL function / syntax.
=IIf(Fields!Name.Value.IndexOf("PL") >= 0,"STREET INTERSECTION","STREET SEGMENT")

Related

SSRS Calculated field with IIF expression gives #error when the condition is false

Hello I'm fairly new to SSRS and I'm working on making my first report for work. It has been going fine until today when I needed make a textbox in Tablix handle both a numbers calculation and text. A column in my SQL table that was previously a purely number field now has n|a for certain rows. So I wrote the following expression to handle those n|as. When the proceeds field is numeric the formula works, but when it's an n|a it shows up on the report as #error and I can't figure out why. I've removed all formatting from the textbox to the same result.
=IIF(Fields!Proceeds.Value<>"n|a",Fields!Proceeds.Value / Fields!DealBalance.Value,"n|a")
As TnTinMn explained, IIF always evaluates both the true and false part of the expression.
The simple fix is to do something like
EDIT Revised due to update from OP
=IIF(Fields!Proceeds.Value<>"n|a",VAL(REPLACE(REPLACE(Fields!Proceeds.Value,",",""),"$","")) / Fields!DealBalance.Value,"n|a")
This simply strips out the $ symbol and commas and then converts the text to a number using VAL(), if the text is not a number it will return zero which will not cause an error as the false part of your expression would give 0/DealBalance.

SSRS syntax error with countdistinct iif

I have an SSRS report where I want to count specific results from the larger query (Overall Total - then of those total "Open" and total "Closed"). I'm trying to use the expression:
=CountDistinct(IIF(Fields!CaseStatusCode.Value='OPEN', Fields!CaseID.Value, Nothing))
But whenever I run the report I get:
There is a syntax error in the Value expression for the textrun ‘Textbox24.Paragraphs[0].TextRuns[0]’: ‘)’ expected.
I've added and removed multiple ) but the error persists. I've also tried the expression in different textboxes and the error continues (just changing the name of the textbox it's in). What am I missing?
Solved it. Apparently I am supposed to use " instead of '. Corrected code below.
=CountDistinct(IIF(Fields!CaseStatusCode.Value="OPEN", Fields!CaseID.Value, Nothing))

Using OBIEE Presentation Variables in Column Formula

I have a dashboard prompt setting a presentation variable, based on months.
I am then trying to use the presentation variable in column formulae, however I am getting the following error when I try to preview it by selecting the month of February:
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 27005] Unresolved column: "February". (HY000)
COlumn Formula :
FILTER("Fact WayLeave Movements"."WayLeave Movement" USING ("Dim Date"."Month Name" IN (#{MonthName}{'January'})))
However when I use the same variable in the analysis filter (not in the column formula, but whole analysis) it seems to run fine. But I need the presentation variable applied on particular columns and not on all of them.
Could anyone please advise how to achieve this or what I am doing wrong when using the presentation variable in the column formula.v
--Create a prompt with sql query which will fetch all month name or month number
--Assign a presentation variable to that prompt
--use that variable as a filter condition in analysis for that particular column.
So how it works is--when u select any month name from prompt that will be assigned to variable.And same month name in that variable will be used as filter condition for your column and and it will fetch data accordingly and report will run properly.
PFB a blog related to presentation Variable.
"https://blogs.oracle.com/ExalyticsOBIEE/entry/how_to_pass_presentation_variable
I assume you have setup a presentation variable already called MonthName, yo will need to add the formulae like this (#{MonthName}['#']{'January'}). in between mothname and default January.
Hope that helps.

Format Text to Number format in Report Builder 3.0

I am working with 4 fields in Report Builder 3.0 in which I am trying to format as a number with the corresponding comma. When I use the number format in the Text Box Properties nothing happens. When I export this report to Excel the field has to be converted to a number as it is being exported as a text field.
Do you have any suggestions as to how I can change the formatting in the report itself?
Thanks for your time!
If I pull data from Oracle using an openquery I get the same issue. To resolve:
When you have the Text Box Properties box open, select the function key by the Value.
In the expression, add "Int" at the front of the string with () on each side of expression. (This converts the value of the expression to an integer)
Ex: =Int(Fields!Count.Value)
Close the expression box after making these additions and select "Numbering" in Text Box Properties to format the text box accordingly.

What is the reason of this error in Crystal Reports?

I have a problem with the crystal reports.I have a report in which four tables are bound as source to the tables.In those 4 tables one table database fields are used in the formula fields.When I set that formula field on the report I am getting error this error "Unknown Database Connector Error" in the Preview Report.
Suppose when I remove that field or comment the formula code of that field we are not suppose to get that error.I don't understand that error too.
I have written like this in the formula field
if{students.name} = "" then
else
"Student Name : " + {students.name}
I have googled alot but no use.Can any one help me regarding this ?
I found a solution to install the crystal report for .NET framework 64 bit software.I will be solved :-)
Try:
If Not(Isnull({students.name})) Then
"Student Name : " + {students.name}