Subject |
Filter in rowset |
From |
Juan Antonio <juananbertos@gmail.com> |
Date |
Fri, 19 May 2017 05:18:16 -0400 |
Newsgroups |
dbase.getting-started |
/*
// -----------------------
I'm trying to make a filter in a rowset of a Query by comparing the value of one field with another.
It works if I do it in an SQL statement
"Select * from table1 where field1> field2"
In the Filter help says it can be put as in the WHERE clause of a SQL SELECT.
But when I do the same with a filter it gives me error "operation not applicable"
Can anybody help me ?
Thanks in advance
See example
********* example code ********
*/
if file('tabla1.dbf')
Drop table tabla1
endif
if not file('tabla1.dbf')
Create Table tabla1 (a Character(4), b Character(4), field1 numeric (13,2), field2 Numeric (13,2))
Insert into tabla1 (a, b, field1, field2) VALUES ("any1","any1", 11.0, 0.0)
Insert into tabla1 (a, b, field1, field2) VALUES ("any2"," ",22.0, 22.0)
Insert into tabla1 (a, b, field1, field2) VALUES ("any3","any3",33.0, 0.0)
Insert into tabla1 (a, b, field1, field2) VALUES ("any4"," ", 44.0, 44.0)
Insert into tabla1 (a, b, field1, field2) VALUES ("any5"," ",55.0, 0.0)
Insert into tabla1 (a, b, field1, field2) VALUES ("any6"," ",66.0, 66.0)
endif
** END HEADER -- do not remove this line
//
// Generated on 2010/11/14
//
parameter bModal
local f
f = new prueba1Form()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class prueba1Form of FORM
with (this)
height = 21.4091
left = 51.7143
top = 12.7273
width = 60.1429
text = ""
endwith
this.prueba1 = new QUERY()
this.prueba1.parent = this
with (this.prueba1)
left = 42.7143
top = 0.5455
sql = 'select * from "tabla1.DBF"'
active = true
endwith
with (this.prueba1.rowset)
filter = "field1 > field2"
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.prueba1.rowset
height = 7.1818
left = 5.2857
top = 3.0455
width = 48.0
endwith
this.rowset = this.prueba1.rowset
endclass
********* End of example code ********
|
|