Is Currency type supported in XDATA?

Hi,

I have question, from web application I invoke XDATA service with parameter type Currency.
eg.

function TXDataService.SetCJob(p1:Currency): Boolean;

I check p1 parameter value before invoke service from the WEB App side and value is 0.5

but when I check the same value on the xdata service side (after service invoke from WEB App) I get 5000.0 why ?

Is the parameter type Currency supported in XData Services?

Yes, Currency is supported. Please check the exact request content (body, headers) in the web browser console to first see how the request is being sent to XData server.

You are right ... in request header I have p1 = 5000 instead 0.5 but I don't know why.
The simple code is below. What did I wrong?

Case 1:
procedure TfrmQ.wbtnSaveClick(Sender: TObject);
var a:String;
begin
a:='0.5';
dmDataModule.xdtwbclntClientXData.RawInvoke('IDaWEBService.SetCJob',[StrToCurr(a)],@OnResult);
end;
The p1 in request header is 5000 - WRONG

Case 2:
procedure TfrmQ.wbtnSaveClick(Sender: TObject);
var a:Currency;
begin
a:=0.5;
dmDataModule.xdtwbclntClientXData.RawInvoke('IDaWEBService.SetCJob',[a],@OnResult);
end;
The p1 in request header is 5000 - WRONG

Case 3:
procedure TfrmQ.wbtnSaveClick(Sender: TObject);
begin
dmDataModule.xdtwbclntClientXData.RawInvoke('IDaWEBService.SetCJob',[0.5],@OnResult);
end;
The p1 in request header is now 0.5 - OK

We will investigate, we can reproduce it here. Might be an issue in Pas2JS compiler.

Ok ... thanks I will waiting for good news.

In the current setup, you will have to indeed divide any currency value by 1000 before passing it to RawInvoke.

Hi

Thank you for the answer ... I think that I have to divide by 10000 because Currency has 4 decimal places.

Will it be changed in the next XData release ?

It will stay like that for RawInvoke method. Maybe in future we add a different method that receives an array of const instead of JSValue.