B4X:
Case "A", "B", "C", "D", "E", "O","F"
Log(FieldName.Trim & " = " & FieldValue.Trim)
please is there a function in B4a which i can use to find out whether a given field has a value for example this FieldValue.Trim belcause i would only want to get out fields that has values and leave out the rest. please help
B4X:
Dim jt As HttpJob
jt.Initialize("", Me)
jt.Download("http://kccug.com/Generic_Handler_JSON/HandlerVBAlevelreport.ashx?customerid=" & Account.Text)
jt.GetRequest.Timeout = 10000 ' 10 seconds
Wait For (jt) JobDone(jt As HttpJob)
If jt.Success Then ' if job is success (http status code 200)
Dim RetVal As String
RetVal = jt.GetString
Log(RetVal)
If jt.GetString = "[]" Then
'MsgboxAsync("No Records to Upload Yet for: " & CustID ,"SMIS")
Return
Else
Dim parser As JSONParser
parser.Initialize(jt.GetString)
Dim root As List = parser.NextArray
For Each colroot As Map In root
Dim FieldName As String
Dim FieldValue As String
For I = 0 To colroot.Size - 1
Log(colroot.GetKeyAt(I) & " = " & colroot.GetValueAt(I))
FieldName = colroot.GetKeyAt(I)
Log(FieldName)
If FieldName.Trim.ToUpperCase.EndsWith("POINTS") Then
FieldValue = colroot.GetValueAt(I)
Select Case FieldValue.Trim.ToUpperCase
Case "A", "B", "C", "D", "E", "O","F"
Log(FieldName.Trim & " = " & FieldValue.Trim)
Case "1", "2", "3", "4", "5", "6""7", "8", "9", "10", "11", "12""13", "14", "15", "16", "17", "18", "19", "20"
Log(" (Numeric score for " & FieldName.Trim & ")")
Case "F"
Log(" (No good at " & FieldName.Trim & ")")
End Select
End If
Next
jt.Release
Return
Next
End If
End If
B4X:
[{"ACCOUNT":"05-00005","Name":"DDAMULIRA GEORGE","HISP":"","GPPoints":"F","PhyPoints":"","GeogPoints":"","EconPointst":"B","LitPoints":"","IREPoints":"","LugPoints":"","artpoints":"","FoodPoints":"","TDPoints":"","GermanPoints":"","WoodPoints":"","ArabPoints":"","EnterprPoints":null,"SubMathPoints":"F","CompPOINTS":"F","Principle":5,"Subsidiary":0,"TotalPoints":5}]
Last edited: