SSRS 2008 Contains() - ssrs-2008

In SSRS 2008, I am trying to add a group expression based on the data containing the word "HOLD". Here is what I have currently.
=IIF(Fields!NOTE.Value.ToLowerInvariant().Contains("HOLD"), "Z-HOLD", Fields!DROPZONE.Value)
This is not working. Any ideas on what I have done wrong would be appreciated?

Simple mistake, you're converting the source string to a lower:
=IIF(Fields!NOTE.Value.ToLowerInvariant()
But then you're comparing it with an upper string:
.Contains("HOLD")
Try this:
=IIF(Fields!NOTE.Value.ToLowerInvariant().Contains("hold"), "Z-HOLD", Fields!DROPZONE.Value)

Related

Crystal Reports Formula: Help forming IIF Statement

I am working with Crystal Reports 11.5.10.1263 [CR Developer Type: Full].
I am familiar with Programming and SQL syntax in general and have worked with expressions in SSRS & MS Access but never in Crystal Reports.
Problem:
I modified the SQL in the Crystal report and it has had the desired effect - except in the last part of the report output - where the changes I made to the SQL do not have the desired effect.
The 'desired effect' is that when a field named 'FundNumber' has the values '2595', '2597' Then the field named 'Organization' should be assigned the value '41600'.
The Detail Record in the Report has the following three rows as part of its 'Formula':
+ IIf({Data.Payments} > 0, "+01W ", "-01W ")
+ Left({Data.FundNumber}+ SPACE(6),6)
+ Left({Data.Organization}+ SPACE(6),6)
I want to change the Data.Organization row to an IIF Statement that says [pseucode]:
IIf Data.FundNumber IN ["2595", "2597"] Then "41600" Else Data.Organization
I believe the Left() function is saying 'return the left 6 characters of [Data.Organization + 6 Spaces] ?? and that it has to do with the way the data is presented in the output.
I would appreciate help with creating the IIF statement for this.
I included the 'IIf({Data.Payments} ...' row in case that helps - as my google searches have turned up examples that use IF instead of IIF.
Thanks!
The syntax most of the time is the same as VB. Try
IIF({Data.FundNumber} = "2595" or {Data.FundNumber} = "2597", "41600", {Data.Organization})

How to use In operator for comparing multiple values in EXCEL with Drools

I am trying Drools excel to compare some values of products like I have P1,P2,P3...P10 Now I am comparing it with incoming value from request.
I tried in below way but I am receiving an error.
Can you please help to fix this issue. Hope I am making a simple mistake but not able to find it.
Thanks in advance.
You have too many parentheses.
The value in the product column is substituted as is into $param. The correct syntax we're looking for is ... in ("P1", "P2"); however you've provided ("P1", "P2") as the product value. This transforms to in (("P1", "P2")), which is not correct.
Remove the parentheses from the product cell: "P1", "P2".

SSRS - How to Sum values on a LookUpSet expression

Hi I have a column that uses a lookupset expression =Join(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Format(Fields!cntSelfService.Value, "###,#######0"), "ExecutionCount")).I'm getting an incorrect parameter when I sum that expression to =Join(Sum(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Format(Fields!cntSelfService.Value, "###,#######0")), "ExecutionCount")). The column to sum is cntSelfService. Please advise.
You have a few different issues with your expression.
When you use the FORMAT function, the result is a string, not a
number.
JOIN is used to concatenate strings from a table into a
single string which wouldn't help your issue.
SUM will not work with a LookupSet
Unfortunately, there's not a built-in way to sum values from a LookupSet.
Luckily, users have had this issue for a while and someone created a function in Visual BASIC SumLookUp that will add the values from a lookupset. You add the code in the Report Properties --> Code tab.
Your expression would be:
=CODE.SumLookup(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Fields!cntSelfService.Value, "ExecutionCount"))
See the code in: Need help in calculation using two Datasets using Expression SSRS

Is there a way to do HEX2DEC in SSRS 2008?

Hello I am working with SSRS 2008. I am wondering if there is a way to do HEX2DEC. I have tried a few things but they get error out. I have tried using HEXTOINT.
You can call the Convert.ToInt64 Method directly in the Value expression.
=Convert.ToInt64(Fields!MyHexValue.Value,16)

Crystal Formula to exclude if value does not contain a certain format

I'm trying to exclude any value from a certain field (table.value) that does not match this format AA#####A. Example if they entered APT12345T, or PT12345PT and No Value then I want to exclude it from the report. It needs to match example AP12345P. What selection formula can I use to accomplish this.
Any help is greatly appreciated
Thanks in advance.
try reading Crystal's help topics on the mid() and isnumeric() functions.
here's an example from the help file:
Examples The following example is applicable to both Basic and Crystal
syntax:
Mid("abcdef", 3, 2)
Returns "cd".
so, in your case, you want to strip your value into three pieces,
mid(table.value,1,2)
mid(table.value,3,5)
mid(table.value,8,1)
and build up a three-part boolean variable where:
the first piece is not numeric(), or between 'AA' and 'ZZ', or however
else you want to test for letters,
the second part isnumeric(), and
the third part passes the same test as the first part.
where are you getting stuck?
something like this:
not isnumeric(mid({table.field},1,2)) and
isnumeric(mid({table.field},3,5) and
not isnumeric(mid({table.field},8,1))