Sabina_Compassi
asked on
NOT LIKE (SQL) statement equivalent in C#
I need filter data in a report generated by fast report.
I can use expressions in C# to filter the data (the filter is set in the databand)
Now I need to filter a part of my report to show data only that have NOT a specific string included.
So while the expression
[datafiled].Contains ("string")
works,
the expression
[datafiled].NotContains ("string")
does not. Apparently NotContains is not a valid method
Can anyone help?
Thank you
Sabina
I can use expressions in C# to filter the data (the filter is set in the databand)
Now I need to filter a part of my report to show data only that have NOT a specific string included.
So while the expression
[datafiled].Contains ("string")
works,
the expression
[datafiled].NotContains ("string")
does not. Apparently NotContains is not a valid method
Can anyone help?
Thank you
Sabina
The .NotContains() should work. Check whether your string really contains what you meant. Or show some short example.
Contains method return as a boolean. so you just need to verify if it's returned as false for "not contain"
String.Contains Method
https://docs.microsoft.com/en-us/dotnet/api/system.string.contains?view=net-5.0
@Ryan: I was also thinking this way first. However, it is related to the FastReport framework -- the Contains and NotContains are methods related to the framework.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@it_saige: That was exactly my earlier answer, and I have removed that. The reason is that it probably does not fit the situation. See https://www.fast-report.com/documentation/UserManFrNET-en/index.html?dialogfilterbyselectedvalues.htm
@Sabina: Can you clarify your needs with respect to the above answers?
@Sabina: Can you clarify your needs with respect to the above answers?
I belive that Ryan and I are basing our assumption that the string class Contains method is being used from this line by the OP:
The OP made no mention of a or reference to a FastReport framework.
-saige-
Apparently NotContains is not a valid method
The OP made no mention of a or reference to a FastReport framework.
-saige-
ASKER
@it_saige
@pepr
I have no idea why [datafiled].NotContains ("string") does not work.
According to the https://www.fast-report.com/documentation/UserManFrNET-en/index.html?dialogfilterbyselectedvalues.htm (link pepr is referring to ) it should
nonetheless:
I trried
![datafiled].Contains ("string")
and this elegant and also working very nicely.
Now..
Instead of having to use a complicated statement with && / || : How can I make the string caseinsensitive?
e.g. if the string is "Rabatt" it would work for "RABATT" and "rabatt"??
Thank you for all help
Sabina
@pepr
I have no idea why [datafiled].NotContains ("string") does not work.
According to the https://www.fast-report.com/documentation/UserManFrNET-en/index.html?dialogfilterbyselectedvalues.htm (link pepr is referring to ) it should
nonetheless:
I trried
![datafiled].Contains ("string")
and this elegant and also working very nicely.
Now..
Instead of having to use a complicated statement with && / || : How can I make the string caseinsensitive?
e.g. if the string is "Rabatt" it would work for "RABATT" and "rabatt"??
Thank you for all help
Sabina
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
https://www.experts-exchange.com/questions/29204562/NOT-LIKE-SQL-statement-equivalent-in-C.html#a43221572
@it_saige
Works perfect again, thank you.
Thank you all for you help.
Really much appreciated!
Sabina
@it_saige
Works perfect again, thank you.
Thank you all for you help.
Really much appreciated!
Sabina