Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

EntryCells blank instead of zero plus store that in db?

$
0
0

I'm working on a relatively simple app to get various data from a user and store it in a db (and then show it in lists). My model classes contain a combination of decimals, ints, and strings. However, the default value of the decimal and int fields is 0, which shows up in the entry cells as well as gets stored in the backend db. I get that...but am wondering what the best path forward is to work with this. I would like to store my model objects via sqlite. I have it all working as is, but it stores all the model fields even if a user didn't enter anything. I need it to only store the decimal fields that the user actually enters numbers into, not the fields that have zeroes by default. I don't want to store zero values for all the available fields as I have cases where the user shouldn't enter numbers in some fields. Zero could be a valid number that the user entered though. So in my viewmodels, I could work with all String data even for the decimals and deal with that little bit of extra code to handle that. However, ideally I would still have ints/decimals as the types to be stored in the db. I've toyed around with nullable ints/decimals but can't seem to get that to work at all with the db. Can anyone give me an opinion on the best approach here? Should I store strings all around? Is there something I'm missing with nullable decimals and they should function as I would think with the sqlite db? Do I need to create IValueConverters for everything?...which I don't think solves my db problems in the first place. I need to figure out the best way to handle it in my viewmodel as well as storing it in the backend.

thanks for any insight!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>