Skip to content

CSV Export - #758

Merged
codinguser merged 10 commits into
codinguser:developfrom
sononio:master
Feb 27, 2018
Merged

codinguser merged 10 commits into
codinguser:developfrom
sononio:master

Conversation

@sononio

@sononio sononio commented Jan 10, 2018 •

Copy link
Copy Markdown

This fork adds csv export variant with separator choosing.

There are two variants of export:

  • Acconts info
  • Transactions info

There are three variants of separator:

  • "," - comma
  • ":" - colon
  • ";" - semicolon

@codinguser codinguser left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I made some comments where some changes might be necessary.

Also a few questions:

  • Are these two CSV formats supported by GnuCash desktop? As far as I understand, there is support in the newer (unstable) and future 3.0 version for importing CSV. Please ensure that the CSV we generate can be consumed by the desktop version. See #756
  • Is there any CSV format which supports both accounts and transactions in one file?

Cheers,

names.add("To Rate/Price");
names.add("From Rate/Price");

List<Transaction> transactions = mTransactionsDbAdapter.getAllTransactions();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number of transactions in the database can be quite big for very large books over time. It is not efficient to load everything into memory. It is better to use a cursor to iterate over the database and retrieve the entries you need on-demand.
I know just getting all records is easier at first, but it will become technical debt in the future

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to fix it in 5-10 days. Now i have trouble because i have no big db. Can you help me and give some example of big enough book in xml? I need it to test export speed and compatibility with gnucash desktop

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I do not have any big db. I've been thinking to write some modules in the test framework which generates tons of transactions. But I never got around to it.

No matter, I think you can just switch it to cursor iteration without having to actually have a big book to test it on. Users who have them will appreciate it.

for(int i = 0; i < transactions.size(); i++) {
Transaction transaction = transactions.get(i);
List<Split> splits = transaction.getSplits();
for (int j = 0; j < splits.size()/2; j++) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loops depends on the ordering of the splits in the list. Even if it might be the case at the moment, I would prefer it we did not depend on it. The logic here would change anyway when switching to cursor-based iteration. When modifying it, please do not rely on the ordering of the splits.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to fix it in 5-10 days

mExportFormat = ExportFormat.XML;
mExportWarningTextView.setText(R.string.export_warning_xml);
mExportDateLayout.setVisibility(View.GONE);
mExportSeparatorLayout.setVisibility(View.GONE);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mExportSeparatorLayout does not seem to include the Separator label. If you open the app and switch to CSV and then back to XML, the label Separator is still visible.

<item>QIF</item>
<item>OFX</item>
<item>XML</item>
<item>CSV-accounts</item>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The translation is handled by the CrowdIn platform. No need to do it in the translation files.
I should add this to the development guidelines.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to fix it in 5-10 days

@codinguser

Copy link
Copy Markdown
Owner

I'm reviewing the PR.

@codinguser

Copy link
Copy Markdown
Owner

Thanks for the updates. Sorry it took a while to review it.
I think you missed one of my inline code comments.

  • The Separator label (not the actual options, just the label) is still visible in the UI even when the export format is not CSV. Could you make it show up only for CSV exports?

Also, there were two questions from my first review which you didn't respond to yet

Also a few questions:

  • Are these two CSV formats supported by GnuCash desktop? As far as I understand, there is support in the newer (unstable) and future 3.0 version for importing CSV. Please ensure that the CSV we generate can be consumed by the desktop version. See Export book in CSV format #756
  • Is there any CSV format which supports both accounts and transactions in one file?

Thanks again!

@codinguser
codinguser merged commit 0aae30a into codinguser:develop Feb 27, 2018
@codinguser

Copy link
Copy Markdown
Owner

@sononio I made the changes to the separator label and merged.
Cheers,

@codinguser codinguser mentioned this pull request Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants