About array in post data

Hi there, when I post an array to a XData Server with TXDataWebClient, I find that only the first value in the array can be recieved.The code like below:

Client:
AStudentName:=['a', 'b'];
TmpResponse:=await(RawInvokeAsync('IMyScoreService.GetGradeByStudentName',AStudentName));

Server:
function TMyScoreService.GetGradeByStudentName(
AStudentName: array of variant): TList<Tzhixue_score_summary_view>;
begin
Result:=TXDataOperationContext.Current.GetManager
.Find<Tzhixue_score_summary_view>
.Where(TLinq['studentName']._In(AStudentName))
.List;
end;

My purpose is post an array of string to server and return records witch the value of the field 'studentName' is in the array.

The value of 'AStudentName' on client is ['a','b'] but it is 'a' on server, so I can not get the right return.Can anybody tell me what's wrony with it ??

hello guys, any idea about this??

Use it like this:

AStudentName:=[['a', 'b']];
TmpResponse:=await(RawInvokeAsync('IMyScoreService.GetGradeByStudentName',AStudentName));

It does not work...but I have already found another way...

Thanks a lot

Would you mind sharing what you did?

@wlandgraf On client, I store the array in TStringList and post it with TStringList.Text

Server receives the TEXT and converts it to an array of variant.

I don't think it is smart but it is a solution.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.