Magno 4 Posted January 30, 2020 I am starting a very new Datasnap REST server. Made a simple function to return a query but I am getting the error of the the title's post (Unknown storage format [BIN] ...) I dropped the Json storage for reflect, follow a lot of examples, that's simple, but simply does not works here. Any tip? Share this post Link to post
Lars Fosdal 1792 Posted January 30, 2020 Looks hard at the provided examples of the problem, but draws a blank... Share this post Link to post
Magno 4 Posted January 30, 2020 49 minutes ago, Lars Fosdal said: Looks hard at the provided examples of the problem, but draws a blank... I thought someone could understand, I am trying this: http://docwiki.embarcadero.com/RADStudio/Rio/en/Tutorial:_Using_a_REST_DataSnap_Server_with_an_Application_and_FireDAC Have any table and need to create a function to return its result. The program is complaining that I should provide a valid standard storage (I am using http://docwiki.embarcadero.com/Libraries/Rio/en/FireDAC.Stan.StorageJSON.TFDStanStorageJSONLink) About the examples, there are a lot over there, as I told: not working. So whats the catch? Any tip? Share this post Link to post
Magno 4 Posted January 30, 2020 I tried a simple new project, drop the required, following this example: http://docwiki.embarcadero.com/RADStudio/Rio/en/Tutorial:_Using_a_REST_DataSnap_Server_with_an_Application_and_FireDAC (same above) So I get an error (as the title of this thread suggests) when running the following method: function TServerMethods1.GetDepartmentNames: TFDJSONDataSets; begin // Clear active so that query will reexecute. FDQueryDepartmentNames.Active := False; Result := TFDJSONDataSets.Create; // The "TFDJSONDataSetsWriter" class provides static "ListAdd" method. // It uses reflection to convert results of the query into "TFDJSONDataSets". TFDJSONDataSetsWriter.ListAdd(Result, FDQueryDepartmentNames); end; The unique difference is that the FDQueryDepartmentNames has another name and points to a similar very simple table with a "select * from users". Share this post Link to post
Vinicius Silva 0 Posted May 2, 2020 (edited) I have this same problem. Solved? I need to access the REST / Datasnap server with angular 9.0. In this BIN format I cannot. {"result": [{"type": "Data.FireDACJSONReflect.TFDJSONDataSets","id": 1,"fields": {"FDataSets": {"type": "System.JSON.TJSONObject","id": 2,"fields": {"FMembers": [{"type": "System.JSON.TJSONPair","id": 3,"fields": {"FJsonString": {"type": "System.JSON.TJSONString","id": 4,"fields": {"FValue": "FDQuery1","FIsNull": false,"FOwned": true}},"FJsonValue": {"type": "System.JSON.TJSONString","id": 5,"fields": {"FValue": "eJydVO1y0lAQPSkkIiKNGJVWbP3hC1SfIA3q+IFW0PqzEwtiZtLAQLDiu/iqieduPuZCYaYDTODs\r\n2Y+zd9mL2z0d7GNY/1cBUhgw0r20UoUN4A26+IIFRphhiROYwk4wxW9c4Ir8HD4sJgF3oF414C5e\r\nEqT19F4VVaJ3LGKWKAu+jwaaMPZh2DAewGjBeCi1P+MM56zdw2sM4MIpExNVr0HDY1CX1Ft+mzcY\r\nC3tS/xEeMxlK5YkItQutbULrlQ4kX2RbBF0J9NCn22OCEt/MW6js2MLmelojHC++0nEm8rplyaAy\r\nUaMUPbydrl7oQNLLaQ/ocPl8IzJvMBa5nVXXi2nKdQJXWjrnt7lmW3zvrLpaStN08kW7YGiPaf08\r\nxdzqsWTp812+5U+8rVaSpE+TtJOkzxLCoyQ9Tp8TNRnkI+Izllt4xElNMaQdy+3r83OMgCiWO9ri\r\nyXz8QEj+Y87XNa6GT8Tq5jqUnfBuz3BJq2DtFVY1WmQr/ILNRvjJiMzvEUW5tk+1iGjOHnuCA1Zc\r\n8PHom/K5JBOzR0fyQvFFZZeNFbbJM8bUVBVf8Q/Fpro6s89ulqyW9T+irTr5pZ3vlHhO1OLwVb4+\r\nLzvnvjNDTXNE1Yz5QLzEIa0Z+xlL/9m5i8ms+rJeC19bunVlFgH7iiUyYmyNVoC/0o/LjJB518xb\r\nCHZYcxOr/wZFvs1/4wB/iIac2YjVOxvnX8zT5uIFjLsumSa3ZaLZbdmeUGYTSKXC01nbsvd5P2oP\r\nQ9bxZOKR7OQc/wGJQuTy","FIsNull": false,"FOwned": true}},"FOwned": true}}],"FOwned": true}}}}]} Edited May 2, 2020 by Vinicius Silva Share this post Link to post
programmerdelphi2k 237 Posted January 20, 2023 (edited) try remove "{result:[ ... ]}", then you'll have a another vetorS from your matrix! xx[0] = [.. real values used ..] Quote {"type": "Data.FireDACJSONReflect.TFDJSONDataSets","id": 1,"fields": {"FDataSets": {"type": "System.JSON.TJSONObject","id": 2,"fields": {"FMembers": [{"type": "System.JSON.TJSONPair","id": 3,"fields": {"FJsonString": {"type": "System.JSON.TJSONString","id": 4,"fields": {"FValue": "FDQuery1","FIsNull": false,"FOwned": true}},"FJsonValue": {"type": "System.JSON.TJSONString","id": 5,"fields": {"FValue": "eJydVO1y0lAQPSkkIiKNGJVWbP3hC1SfIA3q+IFW0PqzEwtiZtLAQLDiu/iqieduPuZCYaYDTODs\r\n2Y+zd9mL2z0d7GNY/1cBUhgw0r20UoUN4A26+IIFRphhiROYwk4wxW9c4Ir8HD4sJgF3oF414C5e\r\nEqT19F4VVaJ3LGKWKAu+jwaaMPZh2DAewGjBeCi1P+MM56zdw2sM4MIpExNVr0HDY1CX1Ft+mzcY\r\nC3tS/xEeMxlK5YkItQutbULrlQ4kX2RbBF0J9NCn22OCEt/MW6js2MLmelojHC++0nEm8rplyaAy\r\nUaMUPbydrl7oQNLLaQ/ocPl8IzJvMBa5nVXXi2nKdQJXWjrnt7lmW3zvrLpaStN08kW7YGiPaf08\r\nxdzqsWTp812+5U+8rVaSpE+TtJOkzxLCoyQ9Tp8TNRnkI+Izllt4xElNMaQdy+3r83OMgCiWO9ri\r\nyXz8QEj+Y87XNa6GT8Tq5jqUnfBuz3BJq2DtFVY1WmQr/ILNRvjJiMzvEUW5tk+1iGjOHnuCA1Zc\r\n8PHom/K5JBOzR0fyQvFFZZeNFbbJM8bUVBVf8Q/Fpro6s89ulqyW9T+irTr5pZ3vlHhO1OLwVb4+\r\nLzvnvjNDTXNE1Yz5QLzEIa0Z+xlL/9m5i8ms+rJeC19bunVlFgH7iiUyYmyNVoC/0o/LjJB518xb\r\nCHZYcxOr/wZFvs1/4wB/iIac2YjVOxvnX8zT5uIFjLsumSa3ZaLZbdmeUGYTSKXC01nbsvd5P2oP\r\nQ9bxZOKR7OQc/wGJQuTy","FIsNull": false,"FOwned": true}},"FOwned": true}}],"FOwned": true}}}} here a brief explanation about "result:[" in JSON response: FormatResult Event for REST Responses https://mathewdelong.wordpress.com/2011/09/15/delphilive-2011-recap/ NOTE: you can defined "Handled = true" to get some similar! Edited January 20, 2023 by programmerdelphi2k Share this post Link to post
farmaworld 0 Posted January 20, 2023 3 hours ago, programmerdelphi2k said: try remove "{result:[ ... ]}", then you'll have a another vetorS from your matrix! xx[0] = [.. real values used ..] here a brief explanation about "result:[" in JSON response: FormatResult Event for REST Responses https://mathewdelong.wordpress.com/2011/09/15/delphilive-2011-recap/ NOTE: you can defined "Handled = true" to get some similar! This is my function, where? function TServerMethods1.GetAnaforn: TFDJSONDataSets; begin // Clear active so that query will reexecute. FDQueryAnaforn.Active := False; Result := TFDJSONDataSets.Create; // The "TFDJSONDataSetsWriter" class provides static "ListAdd" method. // It uses reflection to convert results of the query into "TFDJSONDataSets". TFDJSONDataSetsWriter.ListAdd(Result, FDQueryAnaforn); end; Share this post Link to post
programmerdelphi2k 237 Posted January 20, 2023 I dont know your code, then, the basic idea will be some like this: uses FireDAC.Comp.Client, Data.FireDACJSONReflect; // FD reflection var // just for show "how will be..." - NOT REAL CASE!!! just for show the main idea here! fdsjListOfDatasetsFromServer: TFDJSONDataSets; fdDS_Server_With_Data : TFDMemTable; // any FD-dataset class in your app!!! fdDS_Client_To_Receive_Data : TFDMemTable; var LjsDS: TFDJSONDataSets; // //............// /// ========= on server software LjsDS := TFDJSONDataSets.Create; // on server... // // serialization on server TFDJSONDataSetsWriter.ListAdd(LjsDS, 'a name for your dataset, just for control', fdDS_Server_With_Data); // // ----------------------------// // /// ========= on client software // deserialization on client fdDS_Client_To_Receive_Data.AppendData(TFDJSONDataSetsReader.GetListValue(fdsjListOfDatasetsFromServer, 0 { what dataset on list? } )); Share this post Link to post
farmaworld 0 Posted January 21, 2023 For now i don't have a client, i want just expose the data in json format in web browser, because i take the json data with php application. But in my get address in the browser i have the data like this: eJydVO1y0lAQPSkkIiKNGJVWbP3hC1SfIA3q+IFW0PqzEwtiZtLAQLDiu/iqieduPuZCYaYDTODs\r\n2Y+zd9mL2z0d7GNY/1cBUhgw0r20UoUN4A26+IIFRphhiROYwk4wxW9c4Ir8HD4sJgF3oF414C5e\r\nEqT19F4VVaJ3LGKWKAu+jwaaMPZh2DAewGjBeCi1P+MM56zdw2sM4MIpExNVr0HDY1CX1Ft+mzcY\r\nC3tS/xEeMxlK5YkItQutbULrlQ4kX2RbBF0J9NCn22OCEt/MW6js2MLmelojHC++0nEm8rplyaAy\r\nUaMUPbydrl7oQNLLaQ/ocPl8IzJvMBa5nVXXi2nKdQJXWjrnt7lmW3zvrLpaStN08kW7YGiPaf08\r\nxdzqsWTp812+5U+8rVaSpE+TtJOkzxLCoyQ9Tp8TNRnkI+Izllt4xElNMaQdy+3r83OMgCiWO9ri\r\nyXz8QEj+Y87XNa6GT8Tq5jqUnfBuz3BJq2DtFVY1WmQr/ILNRvjJiMzvEUW5tk+1iGjOHnuCA1Zc\r\n8PHom/K5JBOzR0fyQvFFZZeNFbbJM8bUVBVf8Q/Fpro6s89ulqyW9T+irTr5pZ3vlHhO1OLwVb4+\r\nLzvnvjNDTXNE1Yz5QLzEIa0Z+xlL/9m5i8ms+rJeC19bunVlFgH7iiUyYmyNVoC/0o/LjJB518xb\r\nCHZYcx Share this post Link to post
programmerdelphi2k 237 Posted January 21, 2023 as explained in Mathew's post, you can manipulate the response to whatever you want. You don't necessarily need to return a JSON format, in fact you can manipulate the response to whatever format you want. In the end, everything will be a text (string). You are the one who determines the result, not the DataSnap! For convenience and usage, JSON is the default returned format! But you are the one who determines what will be returned! See the event used for this in your project! Share this post Link to post
farmaworld 0 Posted January 23, 2023 ok today i try response with xml file Share this post Link to post