Problem with DBUtils.ExecuteMap

mrjaw

Active Member
Licensed User
Longtime User
My problem now is with DBUtils.ExecuteMap

When I run DBUtils.ExecuteMap and there is no records this functions returns NULL but


PHP: Copy
Dim m As Map
   m.Initialize
   m = DBUtils.ExecuteMap(Main.SQL, "SELECT * FROM t_press",Null)
      
   If m = Null Then 'Null will return if there is no match'
      Main.prefer.puid=0      
   Else
      '
      Main.prefer.Initialize
      Main.prefer.codigo=m.Get("f_codigo")
      Main.prefer.nombre=m.Get("f_nombre")
   End If
The problem here is DBUtils.ExecuteMap return NULL but when it ask for NULL doesnt execute true condition because m,map, is not initialized not null so execute the else but how there is no initialize get error

PHP: Copy
java.lang.RuntimeException: Object should first be initialized (Map).
 
Go on the safe side:
Code: Copy
If m <> Null AND m.IsInitialized Then

Thanks! I will.

Edit: When I put the test in exactly as this I get "Try Catch Block last error message: java.lang.NullPointerException" and the map is null. This is in a code module and the map is declared in the process globals. This is a big deal for me, as elsewhere in the code I have many similar tests. I appreciate any insight you can give for this issue. I think for now I will use executequerysingle result as the test for population...
 
Last edited:
Upvote 0
Back
Top