All right, now moving on to something approaching real-world complexity.
Given, in MySQL:
CREATE TABLE musPeople
(
pkid INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
lastname VARCHAR(50) NOT NULL DEFAULT " ",
firstname VARCHAR(50) NOT NULL DEFAULT " "
);
CREATE TABLE musBands
(
pkid INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
bandname VARCHAR(100) NOT NULL DEFAULT " "
);
CREATE TABLE musSongs
(
pkid INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
songname VARCHAR(100) NOT NULL DEFAULT " "
);
CREATE TABLE musPerfs
(
pkid INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
songid INT UNSIGNED NOT NULL DEFAULT 0,
arttype CHAR(1) NOT NULL DEFAULT " ",
artid INT UNSIGNED NOT NULL DEFAULT 0
);
CREATE TABLE musRecs
(
pkid INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
perfid INT UNSIGNED NOT NULL DEFAULT 0,
reldate DATE NOT NULL DEFAULT "0000-00-00"
);
I want to show a grid with songs and artists.
Perhaps you've built into the bizobj some way to set this up. But, not
knowing about that, I went with the very scary UserSQL. I think it's
well-formed for MySQL but I'm sure I could be wrong (the query, when syntax
is modified for VFP 9, produces the results I expect). In any case, Dabo
gets to the point of processing my UserSQL and then throws an error.
My form code, and the traceback, follow.
Thanks for any help.
Ken
## *!* ## Dabo Code ID: dForm-top
def afterInit(self):
self.setAll()
def afterInitAll(self):
self.PopupMenu()
def populateGrid(self):
self.songGrid.DataSet = self.PrimaryBizobj.getDataSet()
def setupBizobj(self):
self.Application.addConnectFile("C:\DaboProjects\MyMusic\mymusic.cnxml")
conn = self.Application.getConnectionByName("main")
biz = dabo.biz.dBizobj(conn)
# No DataSource; we'll use DataSet instead.
biz.UserSQL = 'SELECT musSongs.song, (SELECT CASE WHEN
musPerfs.arttype == "P" \
THEN musPeople.firstname + " " + musPeople.lastname \
WHEN musPerfs.arttype == "B" THEN musBands.bandname ELSE "
" END \
FROM musPerfs \
JOIN musPeople ON musPeople.pkid == musPerfs.artid \
JOIN musBands ON musBands.pkid == musPerfs.artid \
WHERE musPerfs.songid == musSongs.pkid) AS artist \
FROM musSongs \
JOIN musPerfs ON musPerfs.songid == musSongs.pkid \
JOIN musRecs ON musRecs.perfid == musPerfs.pkid'
biz.KeyField = "pkid"
self.addBizobj(biz)
Traceback (most recent call last):
File "C:\Program Files\Dabo Runtime\dabo\lib\eventMixin.py", line 97, in
raiseEvent
File "ClassDesigner.py", line 1464, in onRunDesign
File "C:\Program Files\Dabo Runtime\ide\ClassDesignerFormMixin.py", line
499, in onRunDesign
File "C:\Program Files\Dabo Runtime\dabo\ui\uiwx\__init__.py", line 883,
in createForm
File "c:\docume~1\kend\locals~1\temp\tmpn10d6d.py", line 9, in __init__
File "C:\Program Files\Dabo Runtime\dabo\ui\uiwx\dForm.py", line 791, in
__init__
File "C:\Program Files\Dabo Runtime\dabo\ui\uiwx\dForm.py", line 43, in
__init__
File "C:\Program Files\Dabo Runtime\dabo\ui\uiwx\dFormMixin.py", line
68, in __init__
File "C:\Program Files\Dabo Runtime\dabo\ui\uiwx\dPemMixin.py", line
200, in __init__
File "C:\Program Files\Dabo Runtime\dabo\ui\uiwx\dForm.py", line 69, in
_afterInit
File "C:\Program Files\Dabo Runtime\dabo\ui\uiwx\dFormMixin.py", line
116, in _afterInit
File "C:\Program Files\Dabo Runtime\dabo\ui\uiwx\dPemMixin.py", line
304, in _afterInit
File "c:\docume~1\kend\locals~1\temp\tmpn10d6d.py", line 65, in afterInit
TypeError: setAll() takes at least 3 arguments (1 given)
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.6/708 - Release Date: 3/2/2007 4:19 PM
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users