Android Question null to zero vb equivalnet nz

Discussion in 'Android Questions' started by kris A, Mar 17, 2015.

  1. kris A

    kris A Member Licensed User

    what is the B4A equivalent of nz() for null to zero in vb?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Where does the null come from? Such a method is not required in most cases.
     
  3. kris A

    kris A Member Licensed User

    its from the geocoder library
     
  4. kris A

    kris A Member Licensed User

    nevertheless I think it is important to have nz function.
     
  5. Troberg

    Troberg Well-Known Member Licensed User

    I didn't even know VB had that, after working with it since 3.0 was released. I've used my own NullToZero and NullToEmptyString instead...

    As soon as you work with databases, chances are that nulls will occur.

    So, some null handling is quite useful to have.
     
    DonManfred likes this.
  6. Troberg

    Troberg Well-Known Member Licensed User

    It's not that hard to make your own:

    Code:
    Sub NullToZero(Value as float) as float
      
    If Value = null Then
        
    Return 0
      
    Else
        
    Return Value
      
    End If
    End Sub
    ...or something along those lines (can't syntax check it now).
     
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