sasa888
23rd September 2002, 23:57
Hi all, is there a build in function in BaaN IV for wild card search? Like in visual basic you can use a sql stmt like "SELECT * FROM Customer WHERE CustName LIKE '" & txtCustomer.txt & "'? I am hoping there is one that can be use in one of my programming script.... Thanks in advance..

sasa

dbinderbr
24th September 2002, 00:16
I believe you will not be able to do the same thing in Baan as you do in VB, but you can get the same result programming a little bit more.

I can post alternative codes to do the same if you want ok.

sasa888
24th September 2002, 00:25
Thanks, dbinderbr, could you please post the alternative codes for me please? Thank you.

sasa

shah_bs
24th September 2002, 02:30
Look up the WHERE clause in the library above.

Here is an extract for what you want:


LIKE operator
The LIKE operator compares operand1 with operand2. Operand2 can contain wild cards. For example:

WHERE name LIKE "[Tt]riton.*"
In this example, "Triton2.1" and "triton" are legal values. In this case, operand2 is a regular expression.
See the expr.compile() function for a list of the possible features that the expression can contain.



BAAN is an extremely powerful language!

sasa888
24th September 2002, 18:27
Thanks! But can we replace whatever user enter in the clause? example: WHERE name LIKE text1 (assuming text1 is a text box for user's input). Thank you.

~Vamsi
24th September 2002, 19:18
Only if you use Dynamic SQL.

sasa888
24th September 2002, 20:15
Sorry to ask this dumb question, but what is the difference between regular baan sql and dynamic sql?

~Vamsi
24th September 2002, 20:41
http://www.baanboard.com/programmers_manual_baanerp_help_functions_database_handling_sql_and_combined_fields
For info on Dynamic SQL look at this page: http://www.baanboard.com/programmers_manual_baanerp_help_functions_dynamic_sql_queries_overview

zacharyg
24th September 2002, 22:01
You can also use embedded SQL.

Example:

extern domain form.field.1

form.field = "some string" as entered by the user

form.field = form.field & ".*" or
form.field = ".*" & form.field
form.field = ".*" & form.field & ".*"


select ttmmm999.*
from ttmmm999
where ttmmm999 like :1
wherebind( 1,form.field )
selectdo
endselect

~Vamsi
24th September 2002, 23:12
Zacharyg,

This has been an unsolved problem for quite a while. I had tried various variations - including expr.compile and stuff. The code you posted does not compile on my system (Baan 5.b). If it does compile and work on your system, please post the code and system info.