QOF help!

Neil Williams linux at codehelp.co.uk
Mon May 3 05:33:32 EDT 2004


On Monday 03 May 2004 7:44, Neil Williams wrote:
> On Sunday 02 May 2004 10:08, Derek Atkins wrote:
> > > I'm trying to understand QOF using the sourceforge example:
> > > http://qof.sourceforge.net/my-obj-example.c.html
>
> > To find the invoices you either need to iterate
> > (using qof_collection_foreach) to build the list, or you need to
> > build and run a Query.
> > No.  The invoices are all properly registered.  You're just not using
> > the right APIs to get at them.

I can't get this clear and I can't find any documentation on exactly how to 
iterate over the existing, registered, GnuCash objects. At the moment, QOF 
isn't make a whole lot of sense. Do I have to create and register yet another 
object to query the invoice object? If not, how do I access the foreach 
routine for GncInvoice?
Where's the documentation for using QOF and Gnucash together?

neil at garfield:/opt/neil/gnucash/src/doc$ grep qof */*
neil at garfield:/opt/neil/gnucash/src/doc$ grep QOF */*
neil at garfield:/opt/neil/gnucash/src/doc$ cd ../../doc
neil at garfield:/opt/neil/gnucash/doc$ grep QOF */*
neil at garfield:/opt/neil/gnucash/doc$ grep qof */*

This little snippet:

	GncInvoice *firstinvoice = gncInvoiceCreate (testbook);
	gncInvoiceSetID(firstinvoice, "1001");
	GncInvoice *secondinvoice = gncInvoiceCreate (testbook);
	gncInvoiceSetID(secondinvoice, "2002");
	printf("Invoice ID: %s\n", gncInvoiceGetID(firstinvoice));
	QofCollection *coll = qof_book_get_collection (testbook, GNC_ID_INVOICE);
	printf("Coll data type: %s\n",qof_collection_get_type(coll));

produces:
neil at garfield:/opt/neil/gnucash/src/import-export/gnc-book-merge$ ./gnc_book_merge
Invoice ID: 1001
Coll data type: gncInvoice

which is fine. What is needed to iterate over both invoices?

I'm not looking at queries today, I just want to get this iteration sorted out 
in my head (and therefore in the gnc_book_merge documentation).

-- 

Neil Williams
=============
http://www.codehelp.co.uk/
http://www.dclug.org.uk/
http://www.isbn.org.uk/
http://sourceforge.net/projects/isbnsearch/

http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20040503/25dc7ffc/attachment.bin


More information about the gnucash-devel mailing list