XDataQuery in Service Operation: Incompatible type string and TXDataQuery

Hi,
I'm trying to invoke a service operation with a query. The Documentation (Service Operations | TMS XData documentation) says I can do this with the TXDataClient and the QueryBuilder

  IMyService = interface(IInvokable)
    [HttpGet] function List(Query: TXDataQuery): TList<TCustomer>;
  Customer := Client.Service<IMyService>.List(
    CreateQuery.From(TCustomer)
      .Filter(Linq['Name'] eq 'Foo')
      .OrderBy('Name')
      .Top(10).Skip(30)
      .QueryString
  );

But the Client doesn't compile this.... Incompatible type string and TXDataQuery.
What I'm missing?

Thank you!

That's because you are calling directly using the interface, which of course requires you to pass a TXDataQuery object.

Thus that's what you can do, simply pass the XDataQuery object:

  QueryReq := TXDataQuery.Create('Name eq ''foo''', 'Name', 10, 30);
  XClient.ReturnedEntities.Add(QueryReq);
  Query := XClient.Service<IMyService>.List(QueryReq);

I agree, though, that the XData Query Builder could also return a TXDataQuery object In addition to a string, for those cases.

Thank you for your reply.

Hmm.. maybe the documentation is wrong? The code above is from the the current documentation.

Indeed, it's wrong. We will fix it.