Progress notes.
Neil Williams
linux at codehelp.co.uk
Sat Feb 12 20:09:47 EST 2005
I just thought I'd explain here how some of the things I mentioned on user are
actually going to be possible!
(but then sent it to user anyway, sorry!)
"1. Query nearly all objects using SQL select statements from within the GUI -
that functionality exists now, it just isn't obvious or given directly to the
user (because there's not a lot more that can be done with the results until
they can be written out somehow)."
I've got pilot-link accepting SQL on the command line and from a file and
querying QOF objects, it's practical to offer a dialog that either allows
hand-editing of SQL (maybe not, eh!) or (advisedly) a kind of HTML-like form
with drop down boxes and options. The only command supported initially will
be 'select' although where and or modifiers are already supported by Linas'
qof_sql_query code. This bit isn't at all new.
"2. Copy (or maybe move) all matching entities (or just a selection of
entities formed some other way) to a separate file, written out in XML (QSF).
It should then be practical to export the data behind any report in XML -
allowing limited data mining."
That's the new functions that resulted from refactoring my own code:
gboolean
qof_entity_copy_to_session (QofSession *new_session, QofEntity *src)
Copy a single QofEntity to another session.
gboolean
qof_entity_copy_list (QofSession *new_session, GList *entity_list)
Copy a GList of entities to another session.
Designed to take a GList from qof_query_run() - this is what I'll use to copy
entities that match a SQL query into a new QofSession that uses QSF.
gboolean
qof_entity_copy_coll (QofSession *new_session, QofCollection *entity_coll)
Copy a QofCollection of entities. to another session.
http://code.neil.williamsleesmill.me.uk/doxygen/group__Backend.html
That last one just sounded useful.
Currently debugging - will commit to QOF (sourceforge) and GnuCash HEAD when
complete.
It could be as simple as:
static void
export_query_func(QofQuery *q) {
GList *entity_list;
QofSession *session;
entity_list = NULL;
entity_list = qof_query_run(q);
session = qof_session_new();
qof_session_begin(session, filename, TRUE, FALSE);
if(qof_entity_copy_list(session, entity_list) == TRUE) {
qof_session_save(session, NULL);
}
qof_session_end(session);
}
"3. Import and merge that data back into another GnuCash file - allowing users
to freely exchange specific items from their data files."
That's QSF -> qof_book_merge -> QofQuery -> QSF -> . . . .
"4. Exchange and convert data between other QOF applications - pilot-link will
be the first - and query that data in real-time using data streams in XML. "
QSF maps - the area with the largest amount of development left to be done.
"5. All the results of those queries can be saved out as XML and/or merged
back into a GnuCash file or become the basis of another query, forming a
recursive query that could be very powerful. "
Follows naturally from the rest.
"Any arrangement of items will be stored - you can have the CoA (with balances
as at a specified date), you can have all your invoices between specified
dates, all invoices for certain customer(s), transactions over a certain
threshold amount, . . . . the possibilities are immense."
The CoA balances would be implemented as Account entities with an Opening
Balance type transaction. There's some code needed for CoA - the hierarchy
will have to be recreated from the GUID referenced in the XML. Each Account
will specify it's own GUID and the GUID of it's parent, if any. It should be
possible to match those up and it may only require a little scripting,
scheme, bash, perl, python . . .
That comes about from the partial QofBook support in QSF - any QOF entity with
a create: foreach: and logical parameters (see the QSF docs)
http://code.neil.williamsleesmill.me.uk/doxygen/group__QSF.html#ga32
can be written out, any number, any mix. Other entities will be carried as
references (using the GUID of the referenced entity) allowing GnuCash and
possibly other programs to re-create the relationships and hierarchies.
"As with all ambitious plans, keeping the system generic and flexible enough
to allow all these different options has meant that the code has taken me a
year so far. I expect the first usable code in time for the first Gnome2
release and further developments beyond that."
Namely:
"There are other things that can be done with the XML that I won't have time
to cover, like XSLT to convert to XHTML pages or even convert into SQL for
importing via a database server, that could allow the data to be imported
into other programs. There's lots going on and loads to get your teeth into."
I'll be more than busy getting the bugs out of this little lot, so if anyone
new (from the users list or elsewhere) offers to help with QSF->XHTML or
QSF->SQL, I'm all ears!
:-)
--
Neil Williams
=============
http://www.dcglug.org.uk/
http://www.nosoftwarepatents.com/
http://sourceforge.net/projects/isbnsearch/
http://www.neil.williamsleesmill.me.uk/
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: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20050213/fa0c5fa1/attachment.bin
More information about the gnucash-devel
mailing list