This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to parse negative values from SQLite database

Tags: None
(comma "," separated)
minnew
Registered Member
Posts
3
Karma
0
I am a somewhat newbie to SQLite (and KMyMoney).

On browsing the SQLite database output, the dollar amount data is stored in a table called kmmSplits in several text fields named “value” and “valueFormatted” . The “value” field is apparently written as a division equation (in a text format) which apparently yields the “valueFormatted” field (again in text format). The “valueFormatted is the correct number amount but the problem is that parenthesis are used to indicate a negative number instead of a simple minus in front of the value. This is apparently an accounting number format, but I don’t know how to parse this into a float value for running calculated SQL queries, etc.. The positive values (without parenthesis) are no problem to convert to FLOATS.

I’ve tried using the CAST to FLOAT function but this does not do the division math, nor does it convert parenthesis into negative values.

The basic question is: how to parse a text value containing parenthesis in the “valueFormatted field (accounting money format) into a common number format OR, alternatively, how to convert a division equation in the “value” field to an actual calculation.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]