B4J Question [BANano] Is it possible to have .GetAttr & .GetData to have a Default Return Value when null?

Mashiane

Expert
Licensed User
Longtime User
Ola

With maps, one is able to execute .GetDefault so that when the value is null, it defaults to the default value.

I'm finding myself using data-attributes and also attributes that I am retrieving, as a result, the safest way for me is..

be is a BANanoElement.

B4X:
Dim sDataMaxWidth As String = be.GetData("maxwidth")
    If BANano.IsNull(sDataMaxWidth) Then sDataMaxWidth = ""
    sDataMaxWidth = BANano.parseInt(sDataMaxWidth)

When an attribute by some chance does not exist, I have to execute BANano.IsNull(?)

Is there something like .GetDataDefault(?, "") that one can run instead, I have a lot of data-attributes.

Thanks

PS: This is helping me kinda move most things to the abstract designer and thus less coding.
 
Top