Page 1 of 1

Where Clause - Not Like

Posted: February 28th, 2022, 6:26 pm
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 1065 times
Notlikewhereclause.PNG
Notlikewhereclause.PNG (24.34 KiB) Viewed 1065 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?

Re: Where Clause - Not Like

Posted: February 28th, 2022, 6:29 pm
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 1064 times
Notlikewhereclause (2).PNG
Notlikewhereclause (2).PNG (29.62 KiB) Viewed 1064 times

Re: Where Clause - Not Like

Posted: March 1st, 2022, 10:07 am
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 1056 times
Operator.png
Operator.png (16.03 KiB) Viewed 1056 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.

Re: Where Clause - Not Like

Posted: September 14th, 2022, 11:32 am
by JustinVanRegenmorter
This change has been implemented as of DesignTime Revision 2395, RunTime Revision 1059, and ECC Revision 120.