GAURAVGUPTA9
18th October 2002, 09:00
hi
can ne body help me out how to use like in select statement.
i used
select tiitm001.item,tiitm001.dsca
from tiitm001
where tiitm001.dsca like dsca.f
selectdo
endselect
it didn't work
GAurav
hklett
18th October 2002, 09:12
For proper working of the like statement you have to use a wildcard.
Baan use hier the .* .
Example if you want to find all item where item code matches against pattern somewhere in the string you have to use
like ".*pattern.*" .
manusatsangi
18th October 2002, 10:34
Hi,
The following would work:
dsca.f = ".*" & dsca.f & ".* *"
select tiitm001.item,tiitm001.dsca
from tiitm001
where tiitm001.dsca like dsca.f
selectdo
endselect
Refer to the following thread also for more details.
Using Query by Form (ttstpqbf)
(http://www.baanboard.com/baanboard/showthread.php?s=&threadid=6781)
Warm Regards
Manu
~Vamsi
18th October 2002, 17:17
To the extent that I know like does not take variables. It has be a string. For ex:
select tiitm001.item,tiitm001.dsca
from tiitm001
where tiitm001.dsca like "^Vamsi.*"
selectdo
endselect
will work. But the previous example given by Manu with dsca.f = "^Vamsi.*" will not. Or atleast I have not figured a way to make it work :).
hklett
18th October 2002, 18:16
Hi Vamsi,
I remember the problem.
Ithink the solution is using dynamic sql:
long sql
sql = sql.parse( "SELECT table.* from table where table.field like .*" & dsca.f & ".*" )