devxlogo

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.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Seasoned Architects Evaluate New Tech

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.