Android Question Understanding Maps

Frank Cazabon

Member
Licensed User
Longtime User
Update: I think the problem was that I had declared my variables as Object, not Int!


Hi,

I'm getting a strange result when working with a Map which makes me think I am not understanding something properly.

Code:
    Dim currentRoute As Map
    currentRoute = DBUtils.ExecuteMap(SQLLite, "SELECT srt_approved, srt_mustrefresh, srt_refreshed FROM SelectedRoute", Null)
    If currentRoute.IsInitialized Then
  
        approved = currentRoute.Get("srt_approved")
      
        Dim mustRefresh As Object
        mustRefresh = currentRoute.Get("srt_mustrefresh")
      
        Dim refreshed As Object
        refreshed = currentRoute.Get("srt_refreshed")
  
        If approved = 0 Then
            TabManager.setTabEnabled2(tbhMain, True, 1) ' load awbs
            TabManager.setTabEnabled2(tbhMain, True, 2) ' approve run sheet
            TabManager.setTabEnabled2(tbhMain, False, 3) ' deliver awbs
            TabManager.setTabEnabled2(tbhMain, False, 4) ' upload to server
        Else
      
            If (mustRefresh = 0) Then
                        TabManager.setTabEnabled2(tbhMain, False, 1) ' load awbs
                        TabManager.setTabEnabled2(tbhMain, False, 2) ' approve run sheet
                        TabManager.setTabEnabled2(tbhMain, True, 3) ' deliver awbs
                        TabManager.setTabEnabled2(tbhMain, True, 4) ' upload to server
            End If
          
            If (mustRefresh = 1 AND refreshed = 0) Then
.
.
.

In the watch window approved has value 1 (0x1) and the code goes into the first Else.

mustRefresh is 1 (0x1) so it skips the If (mustRefresh = 0) Then loop

refreshed is 0 (0x0) so I would expect it to go into the If (mustRefresh = 1 AND refreshed = 0) Then loop, but it doesn't!

The fields are all created as type DB_Integer.

Can anyone explain what I am seeing here, please?
 
never worked with sqlite but are you sure your variable need to be objects and not plain INTs to make sure you can compare it with a numerical value like 0 & 1 ?

try

Code:
Dim mustRefresh As int
mustRefresh = currentRoute.GetInt("srt_mustrefresh")
 
Last edited:
Upvote 0
never worked with sqlite but are you sure your variable need to be objects and not plain INTs to make sure you can compare it with a numerical value like 0 & 1 ?

try

Code:
Dim mustRefresh As int
mustRefresh = currentRoute.GetInt("srt_mustrefresh")

Thanks, that was the problem and as usual I realised it as soon as I posted my question. :( sorry to waste your time
 
Upvote 0
Back
Top