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?
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?
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.