Can't get a If staement to work

CD Tom

Member
Licensed User
Longtime User
I'm so frustrated right now I'm about to scream. I've added a column to my database that contains either a Yes or No I've added some code to my code to retrieve the data along with the new column. I want to test the new column and if Yes the program will load a picture. If I set the idc variable to Yes and don't do the m.get the pictures loads fine It seems like the m.get command doesn't do anything. If I put a pause on it the program stops and then shuts down with the log error "OutOfMemoryError" Code as follows:
B4X:
Sub sv_ItemClick(Value As String)
   Dim id As String
   Dim idc As String
   Dim VYes As String
   Dim m As Map
   Dim Val() As String
   id = 0
   VYes = "Yes"
   LblFName.Visible = True
   lblDJoined.Visible = True
   lblbdate.Visible = True
   lblassoc.Visible = True
   lblpaid.Visible = True
   imgview.Visible = True
   lblsign.Visible = True
   btnAssoc.Visible = True
   btnFLName.Visible = True
   
   m.Initialize
   Val = Regex.Split(",", Value)
   m = DBUtils.ExecuteMap(SQL1, "SELECT mbr_first_name, mbr_last_name, address_1, city, state, zip_code, e_mail, home_phone, datej, description, birthd, duesp, assc_last_name, assc_first_name, mbr_prox, assoc_prox, reldate, ActCert FROM mbrs where mbr_number = ?", Array As String(Val(0)))
   If m.IsInitialized = True Then
      id = m.Get("mbr_prox") ' load mbr prox into i
      idc = m.Get("ActCert") ' check for range certified
      If idc = VYes Then
         imgCert.Visible = True
         picture = LoadBitmap(File.DirRootExternal,"TCGCPhotos/Rangecert.jpg")
         imgCert.SetBackgroundImage(picture) ' this will set picture
      Else
         imgCert.Visible = False
      End If
      If File.Exists(File.DirRootExternal,"TCGCPhotos/"&id&".jpg") = True Then   
         picture = LoadBitmap(File.DirRootExternal,"TCGCPhotos/"&id&".jpg") 'this will load picture 
         imgview.SetBackgroundImage(picture) 'this will set picture
      Else
         picture = LoadBitmap(File.DirRootExternal,"TCGCPhotos/Noimages.jpg")
         imgview.SetBackgroundImage(picture)
      End If
      btnFLName.Text = m.Get("mbr_first_name") & "   " & m.Get("mbr_last_name")
      lblAddress.Text = m.Get("address_1")
      lblCSZ.Text = m.Get("city") & ", " & m.Get("state") & " " & m.Get("zip_code")
      lblPhone.Text = m.Get("home_phone")
      lblStatus.Text = m.Get("description")
      lblEmail.Text = m.Get("e_mail")
      lblJoined.Text = m.Get("datej")
      lblBirth.text = m.Get("birthd")
      lblduespaid.Text = m.Get("duesp")
      btnAssoc.Text = m.Get("assc_first_name") & "  " & m.Get("assc_last_name")
      lblrel.Text = m.Get("reldate")
   End If
   
End Sub
I've tried the if statement with the variable and also with a "Yes" but nothing works I've even tried to load a label with the results of the m.get command but when the program hits that comment it stops and the program shut down the error I get in the log is java.lang.outofmemoryerror.
Why is it every time I try and make some small change it takes me hours of trying everything I can think of and then I come to you guys for help.

I've looked at the database and see that there is a Yes or No in the record, and the column name is ActCert text.
 
Last edited:

CD Tom

Member
Licensed User
Longtime User
No that didn't work, it's almost like the m.get("ActCert") doesn't work. Like I mentioned if I comment out that statement and make the idc variable a Yes then the picture shows up. The record I test with shows a Yes in the ActCert column of the database.
 
Upvote 0

CD Tom

Member
Licensed User
Longtime User
Ok, guess what I found the problem. When I added the new column to the database I add it as ActCert Text and that's the way I was trying to get it with the m.get("ActCert") I have a very large data almost 5000 entries while I was cutting the size down to zip up the file I was able to stop the program on the m= dbutils command was when I looked at m I say that in the database the column was actually actcert it didn't keep the caps. When I entered the m.get("actcert") the program worked. I don't understand why it dropped the caps but that something I'll remember in the future.
Thanks for you help
 
Upvote 0
Top