1. gili galili
  2. PowerBuilder
  3. Monday, 28 November 2022 06:46 AM UTC

Hello All,

 

I have a problem with Find method , I need the first expression to work:

ldwc_1.find("( info3 like '%0%'  and info4 like '%3%' )"  ,1,ll_rows) = -5 - what is wrong with this one?

ldwc_1.find("( info3 like '%0%'   )"  ,1,ll_rows)  - this one is fine

ldwc_1.find("( info3= '0'  and info4 = '3' )"  ,1,ll_rows)  - this one is fine

 

Please help

 

Regards

Marina

 

 

René Ullrich Accepted Answer Pending Moderation
  1. Monday, 28 November 2022 07:42 AM UTC
  2. PowerBuilder
  3. # 1

Hi Marina,

It's a feature of Powerbuilder that you have to user brackets if you want to combine "like" expressions with other expressions.

This should work:

ldwc_1.find("( info3 like '%0%' ) and ( info4 like '%3%' )"  ,1,ll_rows) 

Regards,

René

 

Comment
There are no comments made yet.
Markus Eckert Accepted Answer Pending Moderation
  1. Monday, 28 November 2022 07:44 AM UTC
  2. PowerBuilder
  3. # 2

Hi Marina

Try putting brackets around the the two like conditions.

ldwc_1.find("( ( info3 like '%0%' ) and ( info4 like '%3%' ) )"  ,1,ll_rows)

It's probably an operator precedence issue with and being evaluated before like.

Regards,
Markus

Comment
  1. Chris Pollach @Appeon
  2. Monday, 28 November 2022 12:36 PM UTC
Hi Markus ... Correct - brackets, that is the key when using an And/Or within a PB expression. ;-)
  1. Helpful
There are no comments made yet.
gili galili Accepted Answer Pending Moderation
  1. Monday, 28 November 2022 08:36 AM UTC
  2. PowerBuilder
  3. # 3

Yes, it works!

Thank you guys!

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 28 November 2022 09:39 AM UTC
  2. PowerBuilder
  3. # 4

Why not use "Pos(....)" instead of LIKE? I find it more reliable within dw expressions. I've seen some weird behaviors with LIKE over the years.

regards.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.