1. Paul Shue
  2. PowerBuilder
  3. Thursday, 10 August 2023 14:45 PM UTC

 I am trying to do a datawindow find for a varchar column that has an embedded double quote.  The column data is
'Moisture Conditioned Lots 6'' Lifts' and my find first argument for dw find is:  "Pos(Lower(location), 'Moisture Conditioned Lots 6'' Lifts') > 0"
The return code is -5 bad argument. How do I fix this or is there a better way to build the find expression?

 

 

 

 

PB Version

Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 14:49 PM UTC
  2. PowerBuilder
  3. # 1

Try:

"Moisture Conditioned Lots 6~'' Lifts"

 

Comment
There are no comments made yet.
Paul Shue Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 15:02 PM UTC
  2. PowerBuilder
  3. # 2

I tried your suggestion with same result (-5 return code from find)

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 15:06 PM UTC
  2. PowerBuilder
  3. # 3

In addition to Roland's suggestion to preface the double-quote with an "escape" tilde, you might also wish to consider including a Lower() function around the target string:

   Pos(Lower(location), Lower('Moisture Conditioned Lots 6'' Lifts')) > 0

Best regards, John

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 15:19 PM UTC
  2. PowerBuilder
  3. # 4

From the help for the Find method:

Comment
  1. Paul Shue
  2. Thursday, 10 August 2023 15:40 PM UTC
Tried 'Moisture Conditioned Lots 6~~~~~'' Lifts') > 0" if that is what you are wanting to try but that fails also
  1. Helpful
There are no comments made yet.
Paul Shue Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 15:21 PM UTC
  2. PowerBuilder
  3. # 5

Adding the ~ and the lower function resulted in same failure with -5 return code from find.

Comment
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 15:33 PM UTC
  2. PowerBuilder
  3. # 6

Hi Paul,

If your code is exactly as you provided in your post, I don't think you have an embedded double-quote. It appears to be two single quotes.
If your inner quote is a double-quote, then you should be able to get away with just 3 tildes: 'Moisture Conditioned Lots 6~~~" Lifts'.

HTH...regards,

Mark

Comment
  1. Paul Shue
  2. Thursday, 10 August 2023 15:44 PM UTC
I tried "Pos(Lower(location), 'Moisture Conditioned Lots 6~~~'' Lifts') > 0" for my find expression with same failure (-5 return code)
  1. Helpful
  1. Mark Goldsmith
  2. Thursday, 10 August 2023 16:56 PM UTC
Maybe it's just me, or my browser, but when I copy the string you provided and paste it into Notepad, the character right after the 3 tildes is a single quote with another single quote beside it versus a double-quote, like my example above.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 16:11 PM UTC
  2. PowerBuilder
  3. # 7

I have a DW containing addresses, and I edited the data to encapsulate the word Disk with double-quotes ("Disk"), then did the following DW Find:

ls_find = "Pos(Lower(address),Lower('~"DISK')) > 0"
ll_foundrow = dw_1.Find(ls_find,1,9999)

and it returns the correct row number.

Comment
  1. Paul Shue
  2. Thursday, 10 August 2023 17:11 PM UTC
Thanks for your help. I got it to work but my find was slightly different from yours in that my data had a single embedded double quote in it whereas you are just searching for "Disk. My ls_find that is now working;

ls_find = "Pos(Lower(location), Lower('Moisture Conditioned Lots 6~" Lifts')) > 0"
  1. Helpful 1
  1. John Fauss
  2. Thursday, 10 August 2023 17:46 PM UTC
Glad to hear you got it working, Paul. Thanks for the update!
  1. Helpful
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.