Hi Andy,
Using a traditional insert in this case would result in a validation error. You’re correct to say that this is because the API calls for each insert are done individually and this results in an error since total debits =/= total credits
If I understand your use-case correctly, you need to insert multiple line items simultaneously. This can be done by using the JournalLineAggregate column. Please refer to this part of the driver’s documentation (under the INSERT sector)::
https://cdn.cdata.com/help/DXH/odbc/pg_accountingtable-manualjournals.htm
In your case, I believe you would need to use the following query:
INSERT INTO ManualJournals (Narration, JournalLineAggregate)
VALUES (
'Test1', '<JournalLine><LineAmount>1.50</LineAmount><AccountCode>620</AccountCode></JournalLine> <JournalLine><LineAmount>-1.50</LineAmount><AccountCode>611</AccountCode></JournalLine>'
);
This would issue an API request with the following POST body:
<ManualJournals>
<ManualJournal>
<JournalLines><JournalLine><LineAmount>1.50</LineAmount><AccountCode>620</AccountCode></JournalLine> <JournalLine><LineAmount>-1.50</LineAmount><AccountCode>611</AccountCode></JournalLine></JournalLines>
<Narration>Test1</Narration>
</ManualJournal>
</ManualJournals>
Please let me know if your issue persists.
That works perfectly @Erold B Thanks so much!!