Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: PowerBuilder
Expertise: Beginner
Sep 18, 1998

Problem with Filter function and char()

Question:
I want to filter out data from a datawindow during runtime. I have a sle-field in which the user enters a search string (for example, "SM"). This should be used to filter one column in the datawindow, in this case the Name-column. Since the user entered "SM," the program should list:
 
"SMITH JOHNSON" 
"SMITH BERG"
"SMILEY"
and so on--all names beginning with "SM." I tried to use following SetFilter string:

dw_search.SetFilter("left(name, '"+char
(ll_Filter_Length)+"') = '"+ sle_search.Text+"'")
But that doesn't work. If I change '"+char(ll_Filter_Length)+"' to 3 or another digit, it works, but since I want the search function to be flexible (that is, the user can enter different long search words), this isn't any good.

Answer:
You need to use the String function instead of the char function.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date