![]() Registered Member ![]()
|
I'm grateful for your assistance, & sorry for the hassles.
"What version of KMyMoney are you running, and how did you install?" --> I'm using v4.7.1, in Linux Mint x64, & installed via Clay's PPA [ but am waiting / hoping for 4.7.2... viewtopic.php?f=69&t=126090&p=334819#p334819 ]. "...manually editing a copy of your file, to change the precision for the specific currency. If you feel comfortable doing it..." --> i'd certainly be happy to give it a try, if you were kind enough to go the the extra trouble, thanks. Would there be any hazard to my data file, after doing this, once the next KMM version update occurs & begins interacting with my repaired database? |
![]() Registered Member ![]()
|
Let's give it a try. My instruction will be to copy the file, so any modifications will not affect the original .kmy file. It's only to know how much is left in the balance of the savings account, to be able to close it.
In a terminal: cd <directory of the kmymoney file> cp <name of the .kmy file> <name of the .kmy file>.xml.gz gunzip <name>.gz This should output a .xml file. Open the file in kate or gedit, depending on the environment you use. If you are familiar with html, it will seem familiar. Don't worry if you are not, we'll make a very small change. Just make sure you change that and only that. We have to change the fraction for the currency of the savings account. I'll make a guess and provide you the example with Australian dollars. You should search a line toward the end of the file that reads like this: <CURRENCY saf="100" symbol="$" type="3" id="AUD" name="Australian Dollar" ppu="100" scf="100"/> That's the definition of the currency, saf is the smallest account fraction, or hundred per 1 dollar. Now, change: saf="100" to saf="10000" Save the file and close it. Now start KMyMoney and open .xml file. It should open correctly, and display 4 digital places instead of 2. Go to the savings account in question, check the remaining balance. Then, open your original file and modify the closing transaction to include the leftover balance. That should do it, hopefully.
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
![]() Registered Member ![]()
|
Thank you for your excellent detail. Sadly i fell at one of the first hurdles [I really MUST learn more Linux terminal commands!!]. Can you pls see whatever silly error i made [once the initial error msg occurred, i tried various alternatives, but as you can see everything i did was wrong]?...
steffie@steffie-XPS-L501X:~ > ls Desktop OneNote Notebooks PlayOnLinux's virtual drives temp Documents packages.txt Projects Templates Downloads photorec.ses Public Videos Music Pictures Steffie's Kontact Calendar VirtualBox VMs steffie@steffie-XPS-L501X:~ > cd temp/ steffie@steffie-XPS-L501X:~/temp > ls Steffie 2003+.kmy steffie@steffie-XPS-L501X:~/temp > cp Steffie 2003+.kmy Steffie 2003+.kmy.xml.gz cp: target ‘2003+.kmy.xml.gz’ is not a directory steffie@steffie-XPS-L501X:~/temp > cp Steffie 2003+ Steffie 2003+.xml.gz cp: target ‘2003+.xml.gz’ is not a directory steffie@steffie-XPS-L501X:~/temp > cp Steffie 2003+.kmy Steffie 2003+.xml.gz cp: target ‘2003+.xml.gz’ is not a directory steffie@steffie-XPS-L501X:~/temp > |
![]() Registered Member ![]()
|
the problem is the name with spaces, you have to "escape" the space character with a \
cp Steffie\ 2003+.kmy Steffie\ 2003+.kmy.xml.gz Alternatively, you can type "cp Steffie" and hit TAB to let autocomplete do its magic
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
![]() Registered Member ![]()
|
You can also enclose it in quotes
cp "Steffie 2003+.kmy" "Steffie 2003+.kmy.xml.gz"
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
![]() Registered Member ![]()
|
You are rescuing me very nicely, step by step, despite my endless capacity to keep going off the rails
![]() I reopened my xml file & attempted the identical edit as above, so that i could specifically observe that i HAD done it correctly [the balance really did become 0.0000 post-edit]. However STILL i could not close this account [in the xml file] as well. I'm wondering if maybe i need to increase the xml file decimal places [by editing the html file again] not to just 4, but maybe 6 or 8 or 10 decimal places, then try again. What do you think? Of course, the other question banging around in my head here also is "Why on earth am i having all this hassle / how did this rounding error occur in the first place / is there danger this mess might recur in future? |
![]() Registered Member ![]()
|
Try creating the transaction in the xml file, check if you can close the account there.
There's still a potential problem in the future, and I'm currently thinking of a way to address the problem and fix it for good.
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
![]() Registered Member ![]()
|
Hello. I've spent a good few hours on this since the last post, but still not succeeded in closing that account in my normal KMM file... despite successfully being able to close it in the XML file. Rats.
It took many iterations with the XML file before a perfectly zero balance resulted. I ended up having to increase the decimal places hugely... "<CURRENCY saf="1000000000" symbol="$" type="3" id="AUD" name="Australian Dollar" ppu="100" scf="100"/>" , before the balance residual stopped being an irrational fraction & actually ended with a zero... in my case that final decimal value proved to be 0.002919540 . When i then increased that account's final withdrawal transaction by that same amount, its balance became true zero across all the visible decimal places. After achieving that, i was indeed able to close this account... in the XML file. For reasons i don't understand, after switching back to my main KMM .kmy file & making that identical increase to my final transaction, the Close option still stubbornly remained greyed out. In case somehow my .kmy file contents had changed since i made the XML from it, i created a new XML per your instructions & repeated the process... once again i was ultimately able to close this account in the XML. I returned again to the latest .kmy file & increased the final transaction by that latest XML's residual [which had succeeded in the XML]... but annoyingly yet again in the .kmy file that account still refused to be closed. What a total pain this is!! ![]() |
![]() Registered Member ![]()
|
How annoying. I'm sorry that all this happens.
What you could do next: - backup your original file, save it to an archive location - close the account in the xml file - edit the fraction in the currency back to 100 - restart kmymoney, go to Save As... save the .xml file as .kmy. That will save the file in the normal kmymoney format, and you could continue using it in an ordinary fashion. You will have your original file as backup in case you find something wrong (you shouldn't) And you uncovered a problem that we'll have to fix so no one else has to go through this hassle.
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
![]() Registered Member ![]()
|
I took your advice & it worked perfectly. Hence i'm now using what was my xml file, as my "new-normal" kmy file, back to 2 decimal places, & with that troublesome account closed. Furthermore, though logically i expected this to work fine, i then did a "robustness test" on this solution by attempting to re-open this account, inspect it in Ledger view, then re-close it. All behaved properly.
Whilst i'm bamboozled at this mysterious problem's root cause, your wonderful generosity & patience has salvaged the situation for me. I'd like to sincerely thank you, Alvaro, you're a champ. Steffie. |
![]() Registered Member ![]()
|
Thank you for the patience. Glad that it's working ok.
Now, to figure out a permanent solution for this.
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
![]() Registered Member ![]()
|
Hello Hei Ku [quick, run away fast & hide... it's me again, with the SAME problem!]
The symptoms are identical to each of the previous times i have posted about this hassle, in summary: 1. I have an Account ["Asset" type, this time] that has become & will remain evermore Inactive, hence i wish to Close it. 2. Based on my usual *.kmy file's AUD currency, & with the default 2 decimal places, this Account balance was 0.00... but it could not be Closed. 3. It has no Child Accounts. 4. It has no unfinished Schedule. 5. It is not referenced in any Reports [confirmed not only in KMM natively, but also in its XML file opened in text editor Kate [in Linux Mint]. Remembering your previous advice, i repeated the procedure to create the XML file & opened it in Kate, then found the code: <CURRENCY saf="100" symbol="$" type="3" id="AUD" name="Australian Dollar" ppu="100" scf="100"/> & edited it to: <CURRENCY saf="1000000000" symbol="$" type="3" id="AUD" name="Australian Dollar" ppu="100" scf="100"/> Thereafter upon opening this XML file back in KMM, as I'd strongly expected I found that this account balance was NOT zero exactly, out in the far RHS reaches of all those decimal places. I tweaked the final transaction by the tiny amount necessary to produce an adjusted balance of 0.000000000 . HOWEVER, whereas last time I did this procedure [May 2015] the pre-adjustment balance residual stopped being an irrational fraction & actually ended with a zero [0.002919540, back in May], this time once I'd expanded all the decimal places but before I attempted to correct it, it was still irrational all the way to the RHS, ie, did not end in a 0, implying the possibility that in fact even if I adjusted it to zero within the visible decimal places it might still contain some more hidden non-zeros even further to the RHS [ie, invisible to me]. Apprehensively therefore after tweaking that last transaction to make the balance 0.000000000 I re-attempted to Close this account... but it STILL would not Close [context menu item still greyed out]. I knew from my May instance of this procedure, but reconfirmed it today, that in the XML file in Kate i cannot expand the decimal places any further... if i attempt it, every time KMM starts up & tries to open the file, KMM crashes with an ugly error msg... the only way I can prevent that is to return the decimal places to CURRENCY saf="1000000000" ... rather than my attempted CURRENCY saf="10000000000" . My final action, to confirm my ongoing suspicion that the balance is still not perfectly zero, was to do your trick from May, viz: "save your file as an anonymous file, reopen, and check if the balance is non zero? The anonymous file multiplies the transactions by a random huge number, so it will be more visible in that case". Once I'd opened the anonymised file I saw that as expected the balance is not pure-zero, but instead $0.000000002 ... gahhhhhhhhhhhhhhhhhhhhhhh. I seem to have exhausted ALL your previous tricks that worked before. Do you have any new magic tricks to try now pls? BTW... I'm using v4.7.2, in Linux Mint x64, installed via Clay's PPA. PS - Given this problem keeps occurring, I wonder if I am unlucky, or stupid, or all the above? Sigh. |
![]() Registered Member ![]()
|
You are just unlucky, and it's clear that we have to find a better solution for this.
I don't have new tricks unfortunately, other than increasing the fraction to an even bigger number
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
![]() Registered Member ![]()
|
Oh dear; sad. Wrt "other than increasing the fraction to an even bigger number", I would happily do this, as many times as necessary until I could fully/truly/completely zero-out the balance, but as I said, it seems that currently KMM will not accept me expanding the decimal places beyond saf="1000000000" , because then KMM crashes every subsequent start attempt. Hence my follow-on question [probably very silly of me to ask]... might it be possible to fix whatever code inside KMM is crashing when that saf value is set to a bigger number? If so, then I could potentially expand to, eg, saf="1000000000000000000000000" etc, until I could force true zero?
|
![]() Registered Member ![]()
|
Sorry, I had missed that.
Actually, I think it'd be best to have an option to force closing the account (with some tidying up in the background) in these cases.
Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
|
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]