Android Question how to catch a null string value from a database? (json)

Ratna Fang

Member
Licensed User
Longtime User
hi erel,

i have a table in mysql which has 2 fields, varchar (string, isn't it?), and contains null value.
i can retrieve using json. but i don't have any idea how to catch the null value.

this is my simple code:
B4X:
Ph1=M.Get("Phone")
HP=M.Get("HP")

and this is what i tried:
B4X:
If Ph1="" OR Ph1=" " OR Ph1=Null Then
                CallBtn.Visible=False
                PhoneTarget=""
            Else
                CallBtn.Visible=True
                PhoneTarget=Ph1
            End If

i tried several tricks from "", " " (a space between), and Null to catch the null but it didn't work.

could you give me a simple code how to catch null value which retrieved from mysql database using json?

thanks
 

stevel05

Expert
Licensed User
Longtime User
Is M a map? If so you can use GetDefault("Phone","") and it will return the default value supplied instead of the Null. An empty string ("") in this case.
 
Upvote 0
Top