Hey Emexes,
I tried not to post the actual code to make it easier to see the issue. Here is the actual code:
[CODE lang="b4x" title="Original Code"]
Dim ClosedByID As String = Null
Dim ShiftEnd As String = Null
If TRegisterShiftRecord1.ClosedByID <> "" Then
ClosedByID = TRegisterShiftRecord1.ClosedByID
End If
If TRegisterShiftRecord1.ShiftEnd <> "" Then
ShiftEnd = TRegisterShiftRecord1.ShiftEnd
End If
Dim Map1 As Map = CreateMap( "TerminalToken": TRegisterShiftRecord1.ShiftTerminalID, _
"RegisterShiftID": TRegisterShiftRecord1.ShiftID, _
"BatchNumber": TRegisterShiftRecord1.iBatchNumber, _
"OpenedByToken": TRegisterShiftRecord1.OpenedByID, _
"ShiftStart": GeneralLib.GL_AIDTF_ConvertToHost_CheckValid( TRegisterShiftRecord1.ShiftStart, True ), _
"ClosedByToken": ClosedByID, _
"ShiftEnd": ShiftEnd, _
"ShiftStatus": TRegisterShiftRecord1.iStatus, _
"TerminalSyncCall": HTTPShared.CHTTP_TRUE, _
"LastUpdatedTicks": TRegisterShiftRecord1.lngLastUpdated )
Dim JSONGenerator As JSONGenerator
Dim JSONstring As String
JSONGenerator.Initialize(Map1)
JSONstring = JSONGenerator.ToString
[/CODE]
The above produces:
B4X:
ClosedByToken:"null", ShiftEnd:"null"
The workaround is
[CODE lang="b4x" title="Workaround"] Dim Map1 As Map = CreateMap( "TerminalToken": TRegisterShiftRecord1.ShiftTerminalID, _
"RegisterShiftID": TRegisterShiftRecord1.ShiftID, _
"BatchNumber": TRegisterShiftRecord1.iBatchNumber, _
"OpenedByToken": TRegisterShiftRecord1.OpenedByID, _
"ShiftStart": GeneralLib.GL_AIDTF_ConvertToHost_CheckValid( TRegisterShiftRecord1.ShiftStart, True ), _
"ClosedByToken": TRegisterShiftRecord1.ClosedByID, _
"ShiftEnd": TRegisterShiftRecord1.ShiftEnd, _
"ShiftStatus": TRegisterShiftRecord1.iStatus, _
"TerminalSyncCall": HTTPShared.CHTTP_TRUE, _
"LastUpdatedTicks": TRegisterShiftRecord1.lngLastUpdated )
If TRegisterShiftRecord1.ClosedByID = "" Then
Map1.Put("ClosedByToken",Null)
End If
If TRegisterShiftRecord1.ShiftEnd = "" Then
Map1.Put("ShiftEnd", Null)
End If
Dim JSONGenerator As JSONGenerator
Dim JSONstring As String
JSONGenerator.Initialize(Map1)
JSONstring = JSONGenerator.ToString
[/CODE]
The workaround produces
B4X:
ClosedByToken:null, ShiftEnd:null
Thanks for your help!!!