[GNC] Why do Imported Transactions NEED to be Matched?

David Cousens davidcousens at bigpond.com
Mon Apr 27 00:09:18 EDT 2020


A quick look through a copy of the data file suggests that it is somehow
incorporated in the data for the Bayesian matching for an account but I
can't be sure without looking through the code. I use Bayesian matching
rather than the older import name mapping which can be used optionally.

It is always possible to edit the datafile directly but that of course is
fraught with danger. If you do, work on a copy of your data file only.  I do
this a fair bit while working on the documentation, creating a simple
account structure in a new file, importing a couple of typical examples and
then looking at how it is stored.  Keeping the account structure simple
makes finding things a lot easier. A lot of the data is stored in the XML
data file as key-value pairs in a structure with <slot></slot> tags around
it.

I haven't explored the import mapping procedure at all yet in any detail so
I have no real idea of how it works. It was on the todo list to take a
closer look at how it functions. The following is an extract from one of my
import test files which I think  indicates how the mapping is stored within
the structure for each account:
<gnc:account version="2.0.0">
  <act:name>Acme Corp</act:name>
  <act:id type="guid">c39d8f38121b4ea0b6dcfbc65039ef77</act:id>
  <act:type>STOCK</act:type>
  <act:commodity>
    <cmdty:space>ASX</cmdty:space>
    <cmdty:id>ACM</cmdty:id>
  </act:commodity>
  <act:commodity-scu>10000</act:commodity-scu>
  <act:slots>
    <slot>
      <slot:key>import-map</slot:key>
      <slot:value type="frame">
        <slot>
          <slot:key>csv-account-map</slot:key>
          <slot:value type="frame">
            <slot>
*              <slot:key>Assets:Investments:Brokerage Account:Stock:Acme
Corp</slot:key>
              <slot:value
type="guid">c39d8f38121b4ea0b6dcfbc65039ef77</slot:value>*
            </slot>
          </slot:value>
        </slot>
      </slot:value>
    </slot>
  </act:slots>
  <act:parent type="guid">f43d06a3681a42beaac15bfda775df7f</act:parent>
</gnc:account>

I think the bolded bit is where the string in the transfer field is mapped
onto the guid for an account.  You would need to create a similar structure
for each account which would be used as a transfer account, Note this is for
CSV importing only, QIF more than likely has its own import map structure
which i haven't explored at all.  I don't normally import QIF data as a
matter of course but have had my bank generate a couple I use for tesing the
importer while documenting it.

I honestly think it will be far simpler and less likely for you to end up
with a corrupted data file by just mapping the files the first time they
come up in the import matcher which will create these data structures
automatically. I am deliberately discouraging you. I would never attempt
this on my main accounting data files only on test files.

David



-----
David Cousens
--
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-User-f1415819.html


More information about the gnucash-user mailing list