Title: RtcRecord.CheckType not working after upgrade 7.15 -> 8.25 Post by: jeff.lott on September 14, 2017, 09:08:01 PM Code that worked using RTC 7.15 is not working after upgrade to 8.25
POST JSON Body: {"idOrder" : 402317,"idProduct" : 5138154,"Packages" : [],"GeoLocation" : "PA-Blakeslee","GeoPrinterDrum" : "GP-C831","GeoPrinterBottle" : "EPSON-ET-4550","PrintMode" : ""} Code in onDataReceived(Sender: TRtcConnection): Code: PayLoad := Srv.Read; if (JSONPayload.CheckType('idOrder', rtc_Integer) should return true but it is returning false. if I do JSONPayload.asInteger['idOrder'] in watch list it correctly shows 402317. this same CheckType code works on another computer running RTC 8.15. Not sure why? Thanks for any help. Title: Re: RtcRecord.CheckType not working after upgrade 7.15 -> 8.25 Post by: D.Tkalcec (RTC) on September 14, 2017, 09:39:04 PM I will check tomorrow morning.
In the meantime, can you please tell me which Delphi version are you using and which target platform is the App being compiled for? Also, how is the PayLoad variable declared? Thanks. Best Regards, Danijel Tkalcec Title: Re: RtcRecord.CheckType not working after upgrade 7.15 -> 8.25 Post by: jeff.lott on September 14, 2017, 09:55:25 PM Var
JSONPayload: TRtcRecord; PayLoad: String; idOrder: Integer; ... Laptop-OLD: Delphi XE 10 update 1, RTC 7.15. Target Win-64 bpl package used as dynamically loaded "snap-in" module for console/win-service app. Code works as expected. Laptop-NEW: Delphi XE 10.2 update 1, RTC 8.25. Target Win-64 bpl package used as dynamically loaded "snap-in" module for console/win-service app. Code not working as expected. JSONPayload.CheckType('idOrder', rtc_Integer) returns false but idOrder := JSONPayload.asInteger['idOrder']; will set idOrder correctly to 402317 Title: Re: RtcRecord.CheckType not working after upgrade 7.15 -> 8.25 Post by: D.Tkalcec (RTC) on September 15, 2017, 07:01:22 AM Thanks for reporting this.
It was the new number format checker for JSON, which wasn't skipping white-space, resulting in all JSON numbers with white-space to be stored as strings. You could still access the number with asInteger because of the automatic type conversion (implemented for most RTC Value types to-and-from a String). Please, download RTC SDK v8.28 (just released) and let me know if it works as expected, or if you bump into any other problems. Best Regards, Danijel Tkalcec Title: Re: RtcRecord.CheckType not working after upgrade 7.15 -> 8.25 Post by: jeff.lott on September 15, 2017, 02:00:57 PM It is working great now, bug fixed.
Thanks for the quick response. Best Regards, Jeff |