Forum Xamarin.Forms

getting whole field data as a sum

In my table, it consists of 3 fields, I need to get the whole one fields data sum into a variable in order to do something. I tried different ways those are not working.

I am using MVVM format in xamarin forms.

I am missing something can anyone help me with this.

Best Answer


  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I think your table is mapped with a class

    public class MyTable
        public int Value1  {get;set;}
        public int Value2 {get;set;}
        public int Value3 {get;set;}
        public int Sum {get {
            return Value1 + Value2 + Value3;    
  • lak1104lak1104 Member ✭✭

    as an example

           Id  count  location
            1   2     colombo
             2   8     colombo
             3   5     colombo  

    i need to get the some of count field

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    is it a SQLite table and SQLite-net package? I think you can use "SUM(Count)" with ExecuteScalarAsync method

  • lak1104lak1104 Member ✭✭

    Sqlite-net package .i don't get it can you show me it with an example

Sign In or Register to comment.