How to implement 'Not In' Filter in SSRS? - sql

I have a field in SSRS that i need to filter on.
For 3 table I can use a IN filter.
But I am in need to use a NOT IN operator. The field contains numeric values.
I need to be able to say not in (30,31,32,33,34,35,36,37,38,39)
I cant do it within the dataset either, needs to be a filter.
How should I achieve it ?

You can use an expression to determine which values are going to be filtered.
Go to Tablix properties/ Filters
In expression use:
=IIF(Array.IndexOf(split("30,31,32,33,34,35,36,37,38,39",","),
CStr(Fields!YourField.Value))>-1,"Exclude","Include")
For Operator use:
=
For Value use:
="Include"
Let me know if this can help you

For a variation of the selected answer that I find easier to use, please see below. This is in a Visibility expression, but should be easily ported to a Filter expression by setting Expression type to Boolean and comparing if Expression = True:
=IIf(InStr("unwanted values here", Fields!fieldToCheck.Value), True, False)

Firstly I would like to say that, to my knowledge, NOT IN is not available in list of operators for filters.
To Achieve the same thing in other way, please refer the following link..it might help you...
http://blog.datainspirations.com/2011/01/20/working-with-reporting-services-filters-part-4-creating-a-not-in-filter/

Related

SQL - After group by filtering down to rows where column value = certain string

Not sure why this isn't working.
When I run the query without HAVING segment ilike 'Enterprise' I get results (see screenshot) but when I add it back in the query returns nothing despite clearly containing instances where segment = 'Enterprise'. I can't find any instances online where having is used to filter for strings so I'm thinking this just isn't possible. Could someone confirm if this is the case and if there is an alternative method if so? Thanks.
You can't use HAVING to filter for strings, you can only use it to filter for numeric values. To filter for strings, you'll need to use the WHERE clause.

grafana multi value query in timestream

i have some problems displaying my aws timestream data in grafana. I added as a global dashboard variable DevEUI with 3 different specific values. But when i am using the multivalue syntax ${DevEUI} in my query with more then one value i get everytime a error.
hope somebody can give me a hint.
Regards and thanks in advance
You are most probably having a list of values as the value of your multivalue Grafana variable, but you are still using the = operator in your query. Try ... and DevEUI IN ('${DevEUI}'). Or maybe without the single quotes or the parantheses... the exact syntax depends on your Grafana variable.
But, this is just an educated guess, since I cannot see neither your database schema nor the definition of this Grafana variable (both of which are important details in a question like yours, for future reference).
This is how I did it for a multivalued string value:
timestream_variable_name = ANY(VALUES ${grafana_variable_name:singlequote})
You might have to adjust the formatting Grafana applies to the concatenated variable value it generates, depending on your data type.
I know this is long after the original question but #alparius pointed me in the right direction so I wanted to update the fix for the problem Joe reported.
Use formatting to get the proper quotes/values when formatting your query. Something like this:
Select * from database where searchiterm IN (${Multi-Value_Variable:sqlstring})

Filter for "contains text" with OR or CASE to allow multiple options in NetSuite. Custom field: Keyword Match option seems available

NetSuite formula(text) problem.
I have a specific search I need to power up but I could also really use this for general use across a few types of reporting.
We use a lot of custom body fields which do not seem to have access to the Keyword Match option in the dropdown system or I would be using commas left and right.
I need to search a single custom field for multiple possible answers.
I was thinking maybe a CASE WHEN formula but I don't have an else.
Lets call the field states. I want this report to only return rows of records where there are the following 5 states in the custom body field "Shipping State". it isn't allowing keyword match. I only want to see transactions with Michigan, New Jersey and Floria (this is hypothetical) so I want just to put a filter in up front to pair down the results.
CASE WHEN {custbody.shippingstate} IS 'Michigan' ...
Can I use an OR construct here? and do I need an else?
I tried using coalesce but I don't think I had the syntax around the coalese right.
Any help for a formula newbie appreciated.
Try the following as a formula text result column in a NetSuite saved search.
CASE WHEN LOWER({custbody.shippingstate}) LIKE '%michigan%'
OR LOWER({custbody.shippingstate}) LIKE '%jersey%'
OR LOWER({custbody.shippingstate}) LIKE '%florida%'
THEN 'Y' END
LIKE conditions are case sensitive, so that's why I incorporated the LOWER() method. Reminder in NetSuite "%" matches any string of any length (including zero length, and "_" matches a single character. If this works as a results column you can add the formula text as a criteria to filter results.

How do I add a wildcard option as an available option for a SSRS paramater?

I'm trying to add in a wild card selection to my one of my dropdowns within a SSRS report that passes in a "%" to the query it is linked to but has a label of "All Vendors" to the end user.
Highlighted is where I would like to see "All Vendors"
I attempted to use the available values option as opposed to the get values from a query option with the idea that I could specify an expression that returns the same values as the query and then specify a single value as described above. But when I tried to do this I received an error like:
"A value expression used for the report parameter "VND" refers to a field. Fields cannot be used in report expressions."
The expression I used was:
=Multilookup(Split(Fields!ve_name.Value, ",")
Available Values Window
Could someone tell me if theres an easier way to accomplish this or if my syntax is just bad and that this is the best way to do this?
As alejandro zuleta, mentions in a comment,
Why don't you just use a multiple valued parameter? Multiple valued parameter include a Select All option. Check this
Using a multiple valued parameter helped.

Create Search Function including AND OR vb .net

Hope you can help me out and inspire me here
I am looking to create a Search function that searches through a datagridview column looking for key words and then filtering based on the result. I have done this already and it works fine. However this is based on the user entering strings into the textbox separating their strings with a comma. So an example would be
A DataGridViewColumn with 3 values
ERROR_QUEUE_MAY05
ERROR_QUEUE_MAY06
ORDER_QUEUE_JAN01
The User then enters the search criteria
ORDER, 06
And the result would be
ERROR_QUEUE_MAY06
ORDER_QUEUE_JAN01
As you can see the filter has used an OR to filter the column
I want the user to be able to use brackets () and also AND statements like you would in a SQL statement so they could use for example
("ORDER" AND "MAY") OR "03"
This would filter the results to show anything with ORDER and MAY in the title or 03.
Has anyone done anything like this in the past or have any ideas of going about it?
Thanks All
One approach is to scan the string from left to right, then recursively call the evaluator every time parentheses are encountered. After a recursive call, replace the parenthesized expression with "true" or "false". If you intend to allow and a higher priority than or, you can treat that recursively as well.