On 11/08/2013 09:58 AM, Ricardo Aráoz wrote:
El 08/11/13 13:23, Paul McNett escribió:
If you want to subfilter the tempcursor from above, it would be:
ds = tc.getDataSet()
ds.execute("select * from dataset where cust_state='CA'")
if ds:
for row in ds:
print ds["cust_name"]
else:
print "no records."
Let's say the tempcursor has a dateTime field, say DTField.
Right now I'm using :
dt = datetime.datetime.now() - datetime.timedelta(days=183)
ds = biz.getDataSet()
ds.filter('DTField', dt, '>=')
and I get my dataSet filtered by a dateTime field.
I am supposing that my original (that is the bizObject's) dataSet
remains unfiltered and untouched (it is linked to a browse control
while I'm using this one to generate a report).
If I were to go the execute() way I guess I would loose the advantage
of dealing with dateTime values. I would have to transform dt to an
int, then check out how is dabo persisting the "T" field type and
convert it to an int with the functions provided by the query language
and then compare both values in a where. Or am I wrong?
If I were to go the getTempCursor() way I would have the same issue
plus I would not be able to refer to "dataset" having to code inside
the query the virtual fields I have already defined in the bizObject,
thus having two pieces of code in different places that are supposed
to do the same thing. Don't like it.
Are my considerations correct? Or am I missing something?
You need to try it out - if it works for you - then it's a home run.
As far as date math - all the solutions work. Date math is available in
the tempcursor, filter, and a second table.
The point is they all work. What is best for your program - you'll have
to decide.
In my case I'm not normally dealing with small datasets so in general
the tempcursor is best for me. I do have tables that are small but they
are almost used as enums for dropdowns and general lookups.
Johnf
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/527d6d1a.8050...@jfcomputer.com