Generic Import API

BenoitGrégoire bock at step.polymtl.ca
Tue Apr 22 00:44:37 CDT 2003


On April 21, 2003 12:10 am, Olaf Faaland wrote:
> Hi,
>
> I'm playing with the import API written by Benoit.  Using the OFX and HBCI
> imports as a model, I've written a quickie test import, but I have two
> questions:

Wow, I am glad someone besides me and cstim is playing with it!  Are the docs 
helpfull?

> 1. From what I can see of the OFX and HBCI code, the transactions initially
> created are never balanced; that is, they have only one split, and the GUI
> always prompts the user to select the 2nd account for the 2nd split.  Is
> that what really happens?  I have access to neither type of service to test
> my understanding.

This is what USUALLY happens, but not always. Some transactions are added 
already balanced.  The GUI will only ask the user for a destination split if 
the transaction isn't balanced when it is passed to the importer.

> 2. My test import creates what appears to me to be a single valid
> transaction. Specifically, there is only one TX shown in the register, and
> diffing the before and after data files shows only one <gnc:transaction>
> object, containing 2 splits.  It shows in the importer, however, with two
> rows.  I've attached the pertinent part of a screen shot, and my code.  Am
> I doing something obviously wrong?

LOL, you are adding it twice:

  	DEBUG("OPF: gnc_file_olaf_import(): Adding the transaction...\n");
        gnc_gen_trans_list_add_trans(gnc_olaf_importer_gui, olaf_trans);

	/* Instead of xaccTransCommitEdit(gnc_trans)  */
	gnc_gen_trans_list_add_trans(gnc_olaf_importer_gui, olaf_trans);

-- 
Benoit Grégoire
http://step.polymtl.ca/~bock/


More information about the gnucash-devel mailing list