Android Question A question about lists

Discussion in 'Android Questions' started by Lary Yenta, May 4, 2015.

  1. Lary Yenta

    Lary Yenta Member Licensed User

    Hey there,

    I have an odd question, I have 2 lists; one list is a merged Date/Time Value that I want to break up into Date,Time while the other has data records (Glucose). The length of each list will always be the same, Is there a way that I can merge these two lists into one memory table? Any help would be much appreciated.

    Thanks,

    Lary
     
  2. sorex

    sorex Expert Licensed User

    is it data entered in your app?

    you could use a custom type to store the date,time,glucose values as seperate parameter values and add that to the list/map.
     
  3. Lary Yenta

    Lary Yenta Member Licensed User

    Yes it is data entered into my app. What I am trying to do is to check data for only a certain period of time. I have the user enter the date they want to start from and then hatch out the data from my main table. Then I want to show the user their data in a table using the Webview.Loadhtml(... code

    Any help would be appreciated.

    thanks,

    lary
     
  4. DonManfred

    DonManfred Expert Licensed User

    You should better describe what exactly you want archieve.
    show us sample code and sample data and tell us what you want the result to be

    With that what you described so far it is hard to give any copngrete advices
     
  5. Lary Yenta

    Lary Yenta Member Licensed User

    Okay, first I want to take the data in my Measurement table and I create 2 lists, one for Glucose values and another for the merged date and time

    Code:
    Sub CheckRptMsCount
      
    Dim Cursor2, Cur As Cursor
        Cursor2 = SQL2.ExecQuery(
    "SELECT measure.Glucose FROM measure inner join users on users.ID = measure.UserID " & _
         
    "where measure.UserID = " & edtID.Text)
         
    If Cursor2.RowCount <> 0 Then
          RRNum2 = Cursor2.RowCount
          RptGlList.Initialize
          
    If Cursor2.RowCount > 0 Then
          
    For Rw1 = 0  To RRNum2 - 1
            Cursor2.Position = Rw1
              RptGlList.Add(Cursor2.GetDouble(
    "Glucose"))
             
    Next
          
    End If
          Cursor2.Close
        
    End If
           
         Cur = SQL2.ExecQuery(
    "SELECT measure.mDate, measure.mTime FROM measure inner join users on users.ID = " & _
         
    "measure.UserID where measure.UserID = " &   edtID.Text)
         
    If Cur.RowCount <> 0 Then
          RRNumD2 = Cur.RowCount
          RptDtList.Initialize
          
    If Cur.RowCount > 0 Then
          
    For Rw1 = 0  To RRNumD2 - 1
            Cur.Position = Rw1
              RptDtList.Add(Cur.GetString(
    "mDate") & " " & Cur.GetString("mTime"))
             
    Next
          
    End If
          Cur.Close
        
    End If
       

    End Sub
    Then, I create 2 new lists where the data corresponds to a user chosen start date

    Code:
    Sub btnGluRpt_Click
      
    Dim Query As String
      
    Dim dates1(RC) As Long
       StTemp = 
    "Partial"
       CheckRptMsCount
       RC=RptGlList.Size
       
    'StartActivity(SimpleGraph)
       DateTime.DateFormat = "yyyy-MM-dd"
       
    DateTime.TimeFormat = "HH:mm"
       RptDt2List.Initialize
       RptGl2List.Initialize
       DtValue = 
    DateTime.DateParse(edtRStDt.Text)
      
    For i = 0 To RC-1
         
    Dim datesplit() As String  'define an array to hold the date and time after we split it 
         datesplit = Regex.Split(" ", RptDtList.Get(i)) 'split Date and  Time at the Space between Date and Time ex.  "2015-1-16 14:30"
         ' Log("epoch: " & DateTime.DateTimeParse(datesplit(0), datesplit(1)))
         ' dates1(i) = DateTime.DateTimeParse(datesplit(0), datesplit(1))  'convert date and time to epoch values so that the graph library can use them
        If DateTime.DateTimeParse(datesplit(0),datesplit(1)) >= DtValue Then
          RptDt2List.Add(RptDtList.Get(i))
           RptGl2List.Add(RptGlList.Get(i))
        
         
    End If
       
       
    Next
     
    '   WebView1.LoadHtml(DBUtils.ExecuteHtml(SQL1, Query, Null, 0, True))
       
       
    End Sub
    {/CODE]

    Thanks,

    Lary
     
    Last edited: May 4, 2015
  6. Lary Yenta

    Lary Yenta Member Licensed User

    Okay, I have come a bit farther, I now can break up my data into the way I would like it to be represented. I am using the following code to do this:

    Code:
    For j = 0 To RC2-1
         
    Dim datesplit() As String
         datesplit = 
    Regex.Split(" ", RptDt2List.Get(j))
         DumbDat = datesplit(
    0) & "," & datesplit(1) & "," & RptGl2List.Get(j)
      
    Next
    now, is there a way that I can take my DumbDat variable and put those 3 values into a memory table? I just don't want to create another table in my DB because it will tend to change a lot.

    I think I should be able to do it using maps but I am just not certain.

    Any help would be appreciated.

    Lary
     
  7. Cableguy

    Cableguy Expert Licensed User

    Why not create a 2d array??
    Then access it easily by
    Data(0,0) 'date
    Data(0,1) 'time
    Data(0,2) ' glucose
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice