When editing / updating a Security, the Market field (which I use to store Country & Sector codes) is not populated with any existing data although changes are stored. Only a small drop-down list of possible markets is shown
although the field seems able to store any string value.
STEPS TO REPRODUCE
1. Open a Security record using the Edit button
The "Market" field is blank
The "Market" field should be populated with any data currently stored iin the field so it can be edited
Linux/KDE Plasma: Opensuse Leap 15.1
(available in About System)
KDE Plasma Version: 5.12.8
KDE Frameworks Version: 5.55.0
Qt Version: 5.9.7
Are you certain that there really is existing data in that field? I just checked, and some securities had that blank, but others had a value shown. I don't believe it is automatically filled in, and I know I don't always enter a value when creating new securities. Perhaps the next time you edit security and do not see a value, you can make a copy of your data file (before using File/Save) uncompress it if necessary (.kmy file is just .xml.gz) and then grep for the security line in the file. (Hint, grep for "SECURITY.*name of sec" or you will likely get far to many hits.) If this seems to complex, just say so, and I can give simpler instructions.
Thanks for the tip re: .kmy files being compressed XML - I didn't know that.
Yes I'm sure the field has been populated in my database (even though it has no default value as you point out).
To test for yourself:
1. Populate the field with one of the Market codes from the drop down box. This code will persist through successive edits.
2. Populate the field with anything else. It will be saved correctly first time but it will NOT persist through an edit of that field.
Since existing market codes DO survive persistent editing, I wondered if this behaviour is by design as a way of validating entries against the drop-down list but that would seem to be unnecessarily proscriptive - precluding the entry of any market codes now or in the future that are not already in the list. Furthermore validation does not explain how ad-hoc entries survive being stored in the first place.
It seems that when selecting the TradingMarket field in the Security > Edit dialog, the first entry in the drop-down list is blank and if left unchanged, any existing data is over-written with NULL when the record is saved. I believe more normal behaviour would be for the first item in the drop down list to be populated with any existing data in the record thus ensuring that, without further action, the existing entry/data is preserved.
I agree something is not right here, and if you can actually enter a value, it should be saved. If you are not meant to enter a new value, you shouldn't even be able to type it (combo-box v drop-down). I suspect the value is not actually even being saved the first time, it just seems to be accepted and remains in the field until you switch to another view. This will likely require some input from one of the developers.
Git commit 06c11e35e04eef6f3be86698e2c11c3da97b2925 by Thomas Baumgart.
Committed on 08/05/2020 at 16:18.
Pushed by tbaumgart into branch '5.0'.
Remember user defined trading markets
M +11 -1 kmymoney/wizards/newinvestmentwizard/kinvestmentdetailswizardpage.cpp
Thank you for reviewing this issue and providing a fix.