Subject Re: SQL Filter
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Wed, 28 Aug 2024 11:17:50 +0530
Newsgroups dbase.getting-started
Attachment(s) Printing _LIKE predicate.pdf

Good Morning Simon,

> Please could someone help. I am trying to filter on an entryfield and then display the result
> mchoice = form.container1.choicebox1.value
>                 
> q=new query()
> q.sql:=select * from "statements.dbf" where source = "%mchoice%"
> q.active:=true
> form.statementsdatamodule1.statements1.rowset.first()

In sql % is used as a wildcard. So the statement should be

q.sql:=[select * from "statements.dbf" where source like "%]+ mchoice+ [%"]

I have attached a help file page for like. Please go through that also.

Once you have removed the errors then we can progress to more elegant
ways of using like where query can be part of form construction code and
value of mchoice can be changed at will.

Regards
Akshat