on 03-05-2007 2:50 PM
Is there any way to use the "contains" functionality without having to use SQL (wildcard characters perhaps)? For example, if a user enters a name containing "Sa" I would like to return all values with those in it (Sam, Sally, Sarah, etc).
In the filter operator, there is an option to filter using contains. Is that a different version though? I tried doing this @NameLast and it didn't work.
Any help is appreciated. Thank you.
If you use a JDBC connection (which always creates a SQL statement), then you must use different syntax in your SQL statement: it must contain a LIKE statement.
A regular statement looks like this:
SELECT fields FROM mytable WHERE mycriteria = "sandra"
If you concatenate a wildcard into it, it e.g. looks like
SELECT fields FROM mytable WHERE mycriteria = "sa*"
or
SELECT fields FROM mytable WHERE mycriteria = "sa%"
Which means, it returns all records that have a string sa* or sa%, which is not a wildcard search, because...
...the wildcard search needs a different SQL-syntax. Such a statement looks like this
SELECT fields FROM mytable WHERE mycriteria LIKE "sa*"
or eventually
SELECT fields FROM mytable WHERE mycriteria LIKE "sa%"
So I guess you need to create and change your SQL statement.
If you are not using SQL it depends on your service. If you use an RFC then your RFC must be able to use wildcrads. So when you enter only sa, then the RFC should create the correct statement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
for ABAP RFC you can create a native sql syntax:
SELECT fields FROM mytable WHERE mycriteria LIKE "sa%"
for a wildcard.
But you can also check if your (condition) string contains a asterik that this will be replaced with a percent symbol, so that your query "uses" a wildcard.
Best Regards,
Marcel
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.