Yuppski
Yuppski

Reputation: 165

"TkPointer not currently supported" error in Delphi 10.1 when passing a populated TObjectList in REST Datasnap

I'm using Delphi 10.1 Berlin and have a REST server.

I'm getting a "TkPointer not currently supported" when trying to pass an object that has a TObjectList property that's been populated.

If I don't populate the TObjectList property then alls fine.

 

    unit uClass_Jobs;

    interface

    uses
      Contnrs, System.Classes, System.SysUtils;

    type
      TJob = class(TObject)
      private
        {$REGION 'Private'}
        FID: Integer;
        FTheName: String;
        FTime_Records: TObjectList;
        {$ENDREGION 'Private'}
      public
        {$REGION 'Public'}
        constructor Create;
        destructor Destroy;
       {$ENDREGION 'Public'}
      end;

      TTime_Record = class(TObject)
      private
        {$REGION 'Private'}
        FID: Integer;
        FFrom_Time: TTime;
        FTo_Time: TTime;
        {$ENDREGION 'Private'}
      public
        {$REGION 'Public'}
       {$ENDREGION 'Public'}
      end;


    implementation

    { TJob }
    constructor TJob.Create;
    begin
      inherited;
      FTime_Records := TObjectList.Create;
    end;

    destructor TJob.Destroy;
    begin
      FreeAndNil(FTime_Records);
      inherited;
    end;

    end.

I'll try and explain using the above example.

I create an object:-

Job := TJob.Create;
Job.ID := 1;
Job.TheName := "JobName";

Pass the Object to the REST Server. All ok.

Same as before to create the Job Object plus:-

Time_Record:= TTime_Record.Create; 
Time_Record.From_Time := Now;
Time_Record.To_Time := Now;
Job.Time_Reords.Add(Time_Record);

Pass the Object to the REST Server. "TkPointer not currently supported".

This error occurs in the ClientClassesUnit1 on the Method created from the server on the line:-

FAddJobCommand.Parameters[0].Value.SetJSONValue(FMarshal.Marshal(Job), True);

Hope that makes some sense. Thanks

Upvotes: 1

Views: 600

Answers (0)

Related Questions