Hi folks,
I have successfully managed to set-up a database and start to generate
useful reports. One such report is based on this SQL code:
SELECT "kcode" AS "reference_designator", COUNT("kcode") AS "QUANTITY"
FROM "pcb_boms" WHERE "pcb_number"='db0006#6' GROUP BY "kcode";
That works just fine in terms of actually creating a meaningful report.
However what I would like to change is this:
WHERE "pcb_number"='db0006#6'
So that instead of hardcoding db0006#6 I would like something along
these lines:
WHERE "pcb_number"=valuefromcombobox
So, what I am therefore doing is passing the combobox value from a form
into the query that's on a report.
I have seen a couple of posts that seem to touch on this, but I'm afraid
I couldn't make head nor tail of what the replies meant! One talked
about setting a filter, but Horst just seemed to be advising to hardcode
the filter in the report.
I can do this:
filtervalue=hk_thisform.get_pyvisible("pcb_number").listcolumn().asstring()
sqlstring = "SELECT kcode AS reference_designator, COUNT(kcode) AS
QUANTITY FROM pcb_boms WHERE pcb_number= " + filtervalue + "GROUP BY kcode;"
db=hk_thisform.database()
query=db.new_actionquery()
query.set_sql(sqlstring)
status=query.execute()
As an on click, which seems to execute, but of course doesn't actually
produce anything! ;~)
I need to be able to somehow knit the two together. I'd be most grateful
if someone could show me how to achieve this.
Many thanks,
Rob
PS To give something back to the project, as I go along, I'm putting
together a sort of Knoda for dummies affair which I'll put on-line as a
pdf and/or Open Office document. Not much use for people who are already
familiar with the whole relational database and SQL subject, but good
(hopefully) for noobs. :~)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Hk-classes-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss