1. Pete Yankovich
  2. PowerBuilder
  3. Thursday, 17 June 2021 16:25 PM UTC

PB 2017R2, using Query Mode for retrieval.  I need to change a where clause to use "like" instead of "=".

Code from retrieval event:

ls_sql = this.GetSQLSelect()
if pos(ls_sql, "S%") > 0 then
   ls_sql = Replace(ls_sql, pos(ls_sql, "mtk_nb_document ="), 17, "mtk_nb_document like")
   li_sql = this.SetSQLSelect(ls_sql)
end if

The Replace command generates the correct SQL, but SetSQLSelect generates this SQL:

and (((mtk_nb_document like '099479S%')))  and (((mtk_nb_document = '099479S%'))) 

Should I be changing the SQL in another event?

Any help is appreciated.

Pete

 

mike S Accepted Answer Pending Moderation
  1. Thursday, 17 June 2021 16:58 PM UTC
  2. PowerBuilder
  3. # 1

sqlpreview event:

if request <> PreviewFunctionRetrieve! then return 0

SetSQLPreview(yournewsqlsyntax)

Comment
  1. mike S
  2. Thursday, 17 June 2021 17:01 PM UTC
NOTE: the new powerserver2021 is not supporting this.

If you plan on using powerserver2021, then you can still do what you want, but it is a lot more involved.
  1. Helpful
  1. Pete Yankovich
  2. Thursday, 17 June 2021 18:08 PM UTC
Thanks Mike, that worked. Appreciate your help!
  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.