[EMAIL PROTECTED] wrote:
As this is getting very involved, I will try to limit the number of questions in
each post.
Yes, it's probably better to have lots of short posts with single subjects than
on long post with several.
(I snipped out things that Ed has already addressed)
Using the app created by AppWizardX with dabo Mysql db, after record is edited
and saved, on re-querying changes are not shown.
Ok, I created a AppWizardX app using the MySQL database on leafe.com, using just
the customers table. Because the encoding on this table isn't utf8, I modified
biz/Base.py and made the afterInit() look like:
import dabo.lib.datanav as datanav
class Base(datanav.Bizobj):
def afterInit(self):
Base.doDefault()
self.Encoding = "latin-1"
self.setBaseSQL()
(by putting self.Encoding in afterInit() instead of in initProperties(), we get
around that error you got after following my instructions of yesterday. It is
also possible that Ed's change fixed that problem but I haven't tested yet.)
I then ran that app, and changed the limit to 5 records because otherwise the
wait is agonizingly long for 1000 records. I then requeried, and selected the
first record ("Alfreds Futterkiste"). I edited the contact field ("Maria
Anders") and added "!!!" after it. I then when back to the select page and
requeried, at which point I got prompted to save my changes, which I did. The
"!!!" was there on the contact record as I expected. I then closed the form and
reopened, and requeried, and the "!!!" were still there.
So... please tell me what is different with what you did versus what I did! :)
AttributeError: 'NoneType' object has no attribute 'Encoding'
Ed's change should fix that, but if you don't want to update Dabo or if it
doesn't work (I haven't tested yet and Ed didn't sound 100% confident about it),
move the self.Encoding out of initProperties() and put it in afterInit()
instead, which does work.
Perhaps in a later incarnation of the report writer, it will be able to handle
linked cursors or bizobjs. But for now, it needs a single denormalized dataset.
This is perhaps my major concern at the moment. In order for this to be at all
successful (or even used), I have to replace reports that are currently
being produced.
These reports all take results from two tables, and show daily results as well
as totals to date. Table1 just returns a single record (based on date
selection). No problem with that. However Table2 returns multiple records,
that must be summarised in several ways (also selected by date).
Don't worry, this is really no problem. I do this stuff all the time.
For example:
dailyInfo1 dailyInfo2 dailyInfo3 etc (from Table1)
So, dailyInfo1...? are fields in table1? Or are they records?
stockTypeA stockTypeB stockTypeC Total
loadPortADaily 1 45 23 69
loadPortATotal 13 105 92 210 (all from Table2)
There may be several load ports (up to 5), as well many different stock types
(up to 70) that change every 30 days.
The number of loadPorts and stockTypes are known before the reports are to be
produced, but change far too frequently to be coded.
...which is why they should be in a database. Do you not have a table for the
loadports and stocktypes?
To produce this report I would normally make several sql calls:
1. select * from Table1 where date=2005/01/10
2. select stockType, info from Table2 where date=2005/01/10 and loadPort=X group
by stockType
(this would be run for each loadPort)
3. select sum(info) from Table2 where where date>=2005/01/01 and
date<=2005/01/10 and loadPort=X group by stockType
(this would be run for each loadPort)
Obviously this approach wouldn't work with Dabo, and denormalising all of this
into one table would be horrible.
For Dabo, you just need to end up with a Python list of dicts, where each item
in the list is a conceptual "record", and each dict has keys/values on
fieldname/fieldvalue. You can construct this "dataset" manually, using the rules
you mention above.
What would be the best way of tackling this problem?
By getting all the data from wherever it is (table1, table2, manual
calculations, whatever) and then putting it into a list of dicts as I say above.
This list of dicts is the "cursor" you will feed to the reportwriter.
--
Paul McNett
http://paulmcnett.com
http://dabodev.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users