ODATA: order in $select statement and field

In the Delphi and .NET versions ODATA queries are sensitive to the order of the fields in a $select statement. Try these two queries and you’ll see that the field will have a correct link if “clientid” is first, but it won’t have a valid link if “clientname” comes first. Is this intended? or is there a way we can get the link to work properly even if clientid is called in an incorrect order? If you leave clientid out it gets an incorrect tag as well. Can I force the primary key to get delivered regardless of the query perhaps?

http://localhost:8099/odata/clients?$select=clientid,clientname&$orderby=clientname%20desc&$skip=1&$top=2&$format=atom
http://localhost:8099/odata/Clients(’{96d83089-425e-4658-99a4-bc09006ee1b5}’)

http://localhost:8099/odata/clients?$select=clientname,clientid&$orderby=clientname%20desc&$skip=1&$top=2&$format=atom
http://localhost:8099/odata/

http://localhost:8099/odata/clients?$select=clientname&$orderby=clientname%20desc&$skip=1&$top=2&$format=atom
http://localhost:8099/odata/Clients()

Thank you,
Ron

Hello,

Sorry for belated answer.

is there a way we can get the link to work properly even if clientid is called in an incorrect order?

Thanks for the report, the issue was logged as #52573.

Please do the following update in uDAOdataDispatcher.pas:

function TDAODataMessage.CreateRowFor(aSchema: TDADataSet;
aTable: SimpleFieldInfoArray; lItems: StringArray): TDAODataEntry;

if lPkeyCount = 1 then begin
for i := 0 to aTable.Count -1 do begin
if _inPK(aTable[i].Name) then begin
lVal := UTF8ToString(lItems[i]);
if (pos(‘=’, lVal) = -1) and
(pos(#39, lVal) = -1) and
(pos(‘,’, lVal) = -1) then
result.EditLink := TDAODataSchemaDispatcher.FixName(aSchema.Name)+‘(’+ lVal+‘)’
else
result.EditLink := TDAODataSchemaDispatcher.FixName(aSchema.Name)+
‘(’#39+ StringReplace(lVal,#39, #39#39, [rfReplaceAll])+#39’)';
Break; // moved
end;
end;
end else begin

Can I force the primary key to get delivered regardless of the query perhaps?

Would you like that primary key was delivered just for the id link
http://localhost:8099/odata/Clients(‘{0b50a902-c2fa-4568-a5d3-e1940f930b2c}’)

or you want it to be included in the query result set?

Aria Cruz
{0b50a902-c2fa-4568-a5d3-e1940f930b2c}

Hope this helps

Thank you. I’ll try the fix.

I was referring to the id link myself. If I only ask for the ClientName field, then I wouldn’t expect the ClientId field to come as well. But I would expect the id link would be formatted correctly.

The issue was logged as #52613. We will inform you when it will be fixed.

Best regards

this issue was fixed. if you need this fix, pls drop email to support@ .