#1 Re: mORMot 2 » Retrieve JSON value » 2025-08-21 22:16:49

ab wrote:

You are still working at HTTP level in your mind: 404 error, bulk JSON result...
Just define services, with high level code, as if it was running locally.
So here you could e.g. return a TOrmUtilisateurs in an "out" parameter, with a boolean for success/failure.

Right, it should be more informative.
Thank you for the advice.

#2 Re: mORMot 2 » Retrieve JSON value » 2025-08-21 22:13:05

flydev wrote:

You are missing the object creation that will trigger an AV and use ObjectToJson, not JsonEncode.
read there: SAD1.18 5.2. Working with Objects

Very helpfull
Thanks!

#3 Re: mORMot 2 » Retrieve JSON value » 2025-08-21 20:54:07

[dcc32 Erreur] Utilisateurs.pas(66): E2250 Aucune version surchargée de 'JsonEncode' ne peut être appelée avec ces arguments

#4 mORMot 2 » Retrieve JSON value » 2025-08-21 17:58:51

DidiL
Replies: 5

Can I be corrected for this code ?
I definitely miss Mormot2 documentation

function TUtilisateursService.GetUtilisateur(aID: TID): RawJSON;
var
  obj: TOrmUtilisateurs;
begin
  if not fClientDB.Retrieve(aID, obj, false) then
  begin
    raise ERestException.Create('404 - Utilisateur non trouvé');
  end;
  try
    Result := JsonEncode(obj);
  finally
    obj.Free;
  end;
end;

#6 mORMot 1 » Investigating about productivity » 2015-01-30 13:30:26

DidiL
Replies: 1

Hi ab,

I'm about to start a new n-Tiers project, and I need to make a definitive choice this week about the framework/tools.
My background:
Delphi, ICS/Midware, RemObjects/custom ORM, RO/DA, Intraweb, .
HTML, a few CSS, and basic understanding of Javascript.

My project is a management application in a LAN.
One desktop rich client with word processing, file up/download, reporting...
3 web clients (pc and tablets) for display and some data input.
About 40 tables, up to 3-4 master/detail levels.

I've been reading a lot and testing a few about DDD and SOLID design for a few weeks.
I really see the mid/long term value in this new way out of RAD.
For the moment I plan to go: SQLite, ORM, Delphi client + SmartMS
BUT, I need to make sure I'll be able to be productive, or at least save equivalent time compared to debugging RAD!

- I'm going to investigate mORMotUI wich seem really flexible:
- is there a dedicated demo?
- Some support for simple record data input?
Another aspect:
- What is the recommended way to manage changes in object definition (ie. renaming or changing a field type)?

Thank for your inputs!

#7 Re: mORMot 1 » Posting data from HTML client » 2015-01-30 12:42:14

Thank you ab,
I got it about Lazarus, and I was already ok for the method's Request format.

Although I would definitely go the SmartMobile way, I was looking for a CRUD javascript sample for my understanding.
I saw through the code "TSQLRestServerURIContext.ExecuteORMWrite" that it is definitely possible.

#8 Re: mORMot 1 » Posting data from HTML client » 2015-01-29 19:07:04

Seems sample 30 uses interfaces based services, which are not available under Lazarus, or may be  I failed in converting the project?

Even if I'm not a javascript developer, I don't mind if I have to use a few javascript to format/encode JSON.
What I want is a clear understanding of the format required for parameters tranmission.
For CRUD requests, and/or for method based services.

#9 mORMot 1 » Posting data from HTML client » 2015-01-29 16:09:58

DidiL
Replies: 4

Hi,
Can someone provide me a sample case for adding a record from a web page?

 <form method="PUT" action="http://localhost:8080/root/SampleRecord/">  ???
   <input type="text" name="Name"/>
   <input type="submit" value="Insert"/>
 </form>

Thanks in advance

#10 mORMot 1 » Documenting the default REST engine » 2015-01-23 22:52:02

DidiL
Replies: 1

Hi,

May be you'll find it trivial, but I ended up creating several select services before finding out (as suspected)
that I could retrieve records simply by sending a WHERE parameter to the default REST engine.

Seems the complete list is stated nowhere else than in mormot.pas.
And dealing with strings in the WHERE clause was not so obvious.

May I suggest enhancing the documentation with a few non trivial examples as below?
http://localhost:8080/root/SampleRecord/?SELECT=id,name
http://localhost:8080/root/SampleRecord/?SELECT=id,name,time&STARTINDEX=2&RESULTS=4
http://localhost:8080/root/SampleRecord/?SELECT=id,name,time&WHERE=(name)=:("james"):or(name)like:("T%"):
http://localhost:8080/root/SampleRecord/?SELECT=id,name,time&SORT=name&DIR=desc


Also, a non trivial sample of service (ie returning rows via ORM) would be very helpful.

Thanks for this great framework,
I'm just scratching the surface! :-)

-
Didier

#11 Re: mORMot 1 » Execution problem under Lazarus/Code Typhon » 2015-01-07 17:40:03

As a quick (and dirty) solution, I've found binaries for this version.
http://vdebris.wordpress.com/lazarus-2-7-1-snapshot/

The test project is successfull (except URI root)
Let's play with the mORMot! smile

#12 Re: mORMot 1 » Execution problem under Lazarus/Code Typhon » 2015-01-07 15:21:55

I've asked them for them for the exact command line to get 2.71 specific version using fpcup.

#13 Re: mORMot 1 » Execution problem under Lazarus/Code Typhon » 2015-01-07 14:41:47

Thanks Arnaud,
I tried again this morning but got a FPC 3.1.1 version, witch gives me the same FPC_VARIANTSETVAR problem...

#14 mORMot 1 » Execution problem under Lazarus/Code Typhon » 2015-01-06 02:58:57

DidiL
Replies: 12

Hi,

I need some help to use mORMot with FPC/Windows 8.1

Using
CodeTyphon32 5.1 / FPC 2.71 / mORMot 1.18
sqlite3fpc.7z (fpc-win32)  -> mormot dir
sqlite3obj.7z  (obj) -> mormot/sqlite3 dir
sqlite3.dll  -> output dir  and system32

Compilation error:
SynCommons.pas(9438,14) Error: function header doesn't match the previous declaration "SetProperty(var tvardata;const AnsiString;const tvardata):Boolean;"

----

Using
Lazarus 1.26 32bit / FPC 2.64 / mORMot 1.18
Lazarus 1.26 32/64bit / FPC 2.64 / mORMot 1.18
Same SQLite3 deployment.

Compilation: OK
But execution error:
TestSQL3 project has raised a class exception: 'External: ?'   At address: 75262F71

----

Thank you for your help.
We've tried on 3 different computers.

Board footer

Powered by FluxBB