Where Clause - Not Like

This forum allows users to post and respond to "How Do I Do ....." questions. The information contained in this forum has not been validated by K-Rise Systems and, as such, K-Rise Systems cannot guarantee the accuracy of the information.
Post Reply
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

Where Clause - Not Like

Unread post by CathyC »

The not like operator automatically puts the wildcard characters around the value. I set up the where clause like this:
Notlikewhereclause.PNG
Notlikewhereclause.PNG (24.34 KiB) Viewed 1030 times
Notlikewhereclause.PNG
Notlikewhereclause.PNG (24.34 KiB) Viewed 1030 times
And expected:
select * from EC_Order_Header WHERE OrderNumber not like 'ORH%'
since the single quotes would be auto filled by the value being an ansistring
but this way I get to choose where the wildcard character goes

but this is what ran:
select * from EC_Order_Header WHERE OrderNumber not like '%ORH%%'

is this what its supposed to do?
Last edited by CathyC on May 3rd, 2023, 11:50 am, edited 1 time in total. word count: 96

Tags:
CathyC
Posts: 472
Joined: November 16th, 2021, 11:15 am
Contact:

Re: Where Clause - Not Like

Unread post by CathyC »

If I click the where clause at a higher level, it shows it as I expected and without the wildcard characters, so I think automatically adding them should not be done. Or in the preview show them
Notlikewhereclause (2).PNG
Notlikewhereclause (2).PNG (29.62 KiB) Viewed 1029 times
Notlikewhereclause (2).PNG
Notlikewhereclause (2).PNG (29.62 KiB) Viewed 1029 times
word count: 55
SteveCap
Posts: 329
Joined: August 26th, 2021, 9:18 am
Contact:

Re: Where Clause - Not Like

Unread post by SteveCap »

This is because of how keys worked and the recommended values we gave for Operator.
Operator.png
Operator.png (16.03 KiB) Viewed 1021 times
Operator.png
Operator.png (16.03 KiB) Viewed 1021 times
We would then change the value based on the operator
like/not like: %{value}%
likeleft: {value}%
likeright: {value}%
likeexact: {value}

Our thoughts are to drop likeleft, likeright, likeexact and do not modify the value for like/not like so you would have to add the % yourself. We would create a dbchange that would go and update all existing values to be %{value}% so they would continue to work as is.

Task 10182 has been created for this.
word count: 108
JustinVanRegenmorter
Posts: 572
Joined: August 26th, 2021, 9:56 am
Contact:

Re: Where Clause - Not Like

Unread post by JustinVanRegenmorter »

This change has been implemented as of DesignTime Revision 2395, RunTime Revision 1059, and ECC Revision 120.
word count: 17
Post Reply