Ola
I've been wondering why my validation has not been working whilst my form actually has values. The record is read as a map record. So for example, Femication Required Yes = 0, the rest the same methodology. My validation is global, it gets the map values, gets the default values and if a default value is blank, there is an error.
On further scrutiny, if the original value is 0 for a key and you execute a getdefault on it, its returned as blank. I need to use .getdefault for my app to work. The assumption is that the value in a map can be anything and of unknown data type.
Reproduction
Result
So as it is the value of "femdays" with .getdefault is blank. Is there a way around this?
Ta!
I've been wondering why my validation has not been working whilst my form actually has values. The record is read as a map record. So for example, Femication Required Yes = 0, the rest the same methodology. My validation is global, it gets the map values, gets the default values and if a default value is blank, there is an error.
On further scrutiny, if the original value is 0 for a key and you execute a getdefault on it, its returned as blank. I need to use .getdefault for my app to work. The assumption is that the value in a map can be anything and of unknown data type.
Reproduction
B4X:
Dim mymap As Map = CreateMap("itemname": "Badi Soap.", "femdays": 0, "femperiod": -1, "itemno": 28)
For Each k As String In mymap.Keys
Log($"Key: ${k}"$)
Dim v As String = mymap.Get(k)
Dim vd As String = mymap.GetDefault(k, "")
Log($"Original: ${v}"$)
Log($"Default: ${vd}"$)
Log("****")
Next
Result
B4X:
app.js:7 Key: itemname
app.js:7 Original: Badi Soap.
app.js:7 Default: Badi Soap.
app.js:7 ****
app.js:7 Key: femdays
app.js:7 Original: 0
app.js:7 Default:
app.js:7 ****
app.js:7 Key: femperiod
app.js:7 Original: -1
app.js:7 Default: -1
app.js:7 ****
app.js:7 Key: itemno
app.js:7 Original: 28
app.js:7 Default: 28
app.js:7 ****
So as it is the value of "femdays" with .getdefault is blank. Is there a way around this?
Ta!