Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting to CSV writes a 0 byte file, 'There are no transactions available to export' message #190

Closed
Apteryks opened this issue Oct 8, 2024 · 7 comments
Assignees
Labels
area/dataports import, export, backup

Comments

@Apteryks
Copy link

Apteryks commented Oct 8, 2024

Steps to reproduce the behaviour

With my GnuCash file loaded:

  1. Select 'Export...' from the burger menu
  2. Select SINCE date or All time (doesn't matter)
  3. Export 'Save As...', with 'Comma-separated values'
  4. Touch Export button

Expected behaviour

Creates a .csv file with transactions in.

Actual behaviour

Prints a There are no transactions available to export message and writes a 0 byte (empty) file.

Software specifications

  • GnuCash Android version: 2.5.2
  • System Android version: 7.0
  • Device type: Tablet (Samsung Galaxy Tab S2)
@Apteryks
Copy link
Author

Apteryks commented Oct 8, 2024

Using adb and logcat to grab the logs off the device, I could see:

10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: Error while exporting transactions to CSV
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: java.lang.ArithmeticException: Division by zero
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at java.math.BigDecimal.divide(BigDecimal.java:1024)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at org.gnucash.android.model.Money.div(Money.kt:360)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at org.gnucash.android.export.csv.CsvTransactionsExporter.writeSplitsToCsv(CsvTransactionsExporter.kt:98)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at org.gnucash.android.export.csv.CsvTransactionsExporter.generateExport(CsvTransactionsExporter.kt:121)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at org.gnucash.android.export.csv.CsvTransactionsExporter.generateExport(CsvTransactionsExporter.kt:52)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at org.gnucash.android.export.ExportAsyncTask.doInBackground(ExportAsyncTask.java:138)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at org.gnucash.android.export.ExportAsyncTask.doInBackground(ExportAsyncTask.java:90)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at android.os.AsyncTask$2.call(AsyncTask.java:304)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
10-08 15:34:40.943 10031 13387 E CsvTransactionsExporter: 	at java.lang.Thread.run(Thread.java:762)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: Error exporting: Failed to generate export GnuCash transactions CSV - Division by zero
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: org.gnucash.android.export.Exporter$ExporterException: Failed to generate export GnuCash transactions CSV - Division by zero
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at org.gnucash.android.export.csv.CsvTransactionsExporter.generateExport(CsvTransactionsExporter.kt:127)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at org.gnucash.android.export.csv.CsvTransactionsExporter.generateExport(CsvTransactionsExporter.kt:52)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at org.gnucash.android.export.ExportAsyncTask.doInBackground(ExportAsyncTask.java:138)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at org.gnucash.android.export.ExportAsyncTask.doInBackground(ExportAsyncTask.java:90)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at android.os.AsyncTask$2.call(AsyncTask.java:304)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at java.lang.Thread.run(Thread.java:762)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: Caused by: java.lang.ArithmeticException: Division by zero
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at java.math.BigDecimal.divide(BigDecimal.java:1024)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at org.gnucash.android.model.Money.div(Money.kt:360)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at org.gnucash.android.export.csv.CsvTransactionsExporter.writeSplitsToCsv(CsvTransactionsExporter.kt:98)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	at org.gnucash.android.export.csv.CsvTransactionsExporter.generateExport(CsvTransactionsExporter.kt:121)
10-08 15:34:40.948 10031 13387 E ExportAsyncTask: 	... 9 more

@Apteryks
Copy link
Author

Apteryks commented Oct 8, 2024

Seems to be the same underlying problem as reported in #98

@Apteryks
Copy link
Author

Apteryks commented Oct 8, 2024

So the line failing is this one:

writer.writeEndToken(split.quantity!!.div(split.value!!).formattedStringWithoutSymbol())

writer.writeEndToken(split.quantity!!.div(split.value!!).formattedStringWithoutSymbol())

where I assume split.value!! is zero for some reason.

@BaumiCoder
Copy link

The error appears also for the Quicken Interchange Format (qif).

@pnemonic78 pnemonic78 self-assigned this Nov 21, 2024
@pnemonic78
Copy link
Collaborator

Fixed in commit cdbc0b8

@pnemonic78
Copy link
Collaborator

Duplicate of issue #98 ?

@Apteryks
Copy link
Author

Yes, I think so.

@djbrown djbrown added the area/dataports import, export, backup label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dataports import, export, backup
Projects
None yet
Development

No branches or pull requests

4 participants