isnull in SSRS expressions - reporting-services

How to use this formula in ssrs-expression
=NOT(isnull({Command.AAID})) or NOT(isnull({Command.HDomain}))
or NOT(isnull({Command.Adomain}))
Thanks.

I think what you're trying to do is display data based on whether or not a field has data in it or not? You can always use an IIF statement with ISNOTHING. See below for the expression.
=IIf(IsNothing(Field!Whatever),0,Field!Whatever)
If that doesn't answer your question, let me know.

So to convert Crystal formula to SSRS-Expression,
You need to write expression like below,
=IIF(Not(IsNothing(Field!AAID)) OR Not(IsNothing(Field!HDomain)) OR NOt(IsNothing(Field!Adomain)),"TruePart","FalsePart")
This expression will work for you!

Related

How to get around '#Error' when a function in MS Report Builder is evaluating a null value?

I hope my title is clear enough. I'm working in MS Report Builder, using a function that applies a regular expression to a queried value in order to get back a certain substring. The regex works fine, so I'll demonstrate a simpler version here to make this less wordy. Here's the gist of my equation:
=IIF(Len(Fields!CourtLocation.Value) < 1, "none",System.Text.RegularExpressions.Regex.Match(Fields!CourtLocation.Value, "(?:[A-Z]{2,4})").Value))
The main purpose is to get that substring, but I added the IIF so that on those occasions when the CourtLocation.Value is empty (I tried Is Nothing in my expression as well), the function returns "none" rather than "#Error"
I've been looking around for a solution, but nothing has worked; it seems like most other people who talk about this are using a mathematical equation rather than trying to get a string. Can anyone help me get rid of that stupid "#Error" value?
You could try this (untested)
=System.Text.RegularExpressions.Regex.Match(
IIF(
Len(Fields!CourtLocation.Value) < 1,
"none",
Fields!CourtLocation.Value
)
, "(?:[A-Z]{2,4})"
).Value
This way the IIF is performed on the string that you want to pass to the regex function, so it always gets a valid value to process
Iif evaluates both sides, so you can nest two Iif statements to avoid the error.
Did you already read this one?
https://sqldusty.com/2011/08/01/ssrs-expression-iif-statement-divide-by-zero-error/
I'll copy the text into the answer if that solves it for you.

what countrows().equals() means in SSRS

I can't understand the structure of the written code
(CountRows("client_code").Equals(Parameters!client_code.Count)
can anyone explain this please?
And where can I find a reference for all the functions that I can use to write Expression in SSRS??
In SSRS we use "=" operator for comparison rather than equals.
Expression mentioned by you below
(CountRows("client_code").Equals(Parameters!client_code.Count)
Rather it should be like
=IIF(CountRows("client_code")=Parameters!client_code.Count,true,false)
What your mentioned code does: It Returns a count of rows within the specified scope, Scope can be Group as well. and it compared with your Report Parameter count.
Here you will find complete list of functions and expression for SSRS.

Julian date in ssrs

How would i convert the below excel Julian date formula into a formula i can use in SSRS 2008 r2
=IF(DATE(YEAR(TODAY()),1,A1)>TODAY(),
DATE(YEAR(TODAY())-1,1,A1)-(MONTH(DATE(YEAR(TODAY()),2,29))=2),
DATE(YEAR(TODAY()),1,A1))
Well, for starters, you'd have to replace all references to A1 with the field reference (Fields!Field_Name.Value) for which you will be placing in the tablix/report equivalent of A1.
IF()
In SSRS, IF() is IIF() in which you start with an expression to be evaluated followed by the result if true and the result if false. It's called IIF because it refers to the mathematical statement of If and only IF.
Date()
In SSRS, Date() is DateSerial() and uses the same setup as Date() in Excel, with Date([Year],[Month],[Day]).
That said, I believe your Excel formula is wrong. For instance, you cannot use a statement in the True section of the If formula without another evaluation expression around it. From what I'm seeing, what is it supposed to calculate when the Month of 2014-02-29 = 2? Look over your formula again and if there are typos, correct them and let me know via a comment. Then I'll come back and help you put together a complete calculation.
Hope this helps!

SSRS: how to group by multiple parameters

I need to create a report using SSRS, it needs dynamicly group by the matrix.
I added a parameter(name: ColumnData) for it and the available value like 'Date', 'Type', 'ServerName',
for a single value, I can edit the group by expression to
=Fields(Parameter!ColumnData.Value).Value
but when the parameter is multiple, Parameter!ColumnData.Value would return a list and I need to use like that:
==Fields(Parameter!ColumnData.Value(0)).Value & Fields(Parameter!ColumnData.Value(1)).Value
but it's not what I want as I need to indicate the index manually...
Anyone knows how to use the multiple parameters in the group by expression?
Thanks a lot!
If you deselect 'Allow multiple values' in the Parameter properties, your group by expression should work as is.
You will then be able to group by the selected value from the parameter.
(It will then not be possible to choose more than one of the values).
But it only makes sense to group on one value, or?
I stumbled on this topic, but my solution was simple. I had to group by multiply fields, and ended using something like this:
<GroupExpression>=Fields!ColumnName1.Value</GroupExpression>
<GroupExpression>=Fields!ColumnName2.Value</GroupExpression>
<GroupExpression>=Fields!ColumnName3.Value</GroupExpression>
But this may not be what you are looking for since you wanted something more generic.
You can check this answer as it has some advices about matrix:
Multiple group expressions in list (ssrs 2005)
Hope that helps.

access iif query do nothing when false

My situation/problem:
TableA
id, postalcode, region
Criteria for the field i want to add value in (postalcode):
=IIf([tableA.Region]="Chicago","60064",[postalcode])
What i need to accomplish is an iif-query where:
In the field postalcode I check in the criteria if the field region equals Chicago. If so fill up the field with postalcode 60064 if not DO NOTHING
For the do nothing part I'm using the fields name, this is wrong?
am i using the criteria in the right field (the field i want to add?)
I'm using a selection query?
As you can see i'm a noob in access queries...
Can somebody give me the right iff statement?
Thx in advance,
D
I'll suggest you bracket table.Region differently, or eliminate the brackets there entirely.
=IIf([tableA].[Region]="Chicago","60064",[postalcode])
=IIf(tableA.Region="Chicago","60064",[postalcode])
If that doesn't fix the problem you're trying to solve, tell us more about the problem. If you're getting an error message, tell us what it says.
Taking a wild guess, that code as a field expression in a query will not give you an editable column in the query result set. If you want to pre-load a column value based on your criteria, but then allow the user to change the value, use a form. In the form's On Current event, load the value as you wish.
This is a dead old post but I think this was what you wanted:
=Like IIf([tableA.Region]="Chicago","60064",'*')
As far as I can understand,
if not DO NOTHING
You need to return nothing if the condition is false.
What you need is the WHERE clause instead of IIF
If I'm understanding your question correctly, you want a NULL value in Postal Code if it's not Chicago?
=IIf([tableA].[Region]="Chicago","60064","")
Please add another IIF query as OR
IIf([Forms]![Run_Macro
Form]![ReturnType_DrpDwn]="Monthly",[Forms]![Run_Macro
Form]![Cmb_Per_Ending],#1/1/2010#)
IIf([Forms]![Run_Macro Form]![ReturnType_DrpDwn]="Quarterly",#1/1/2010#,#1/1/2025#)