#1 mORMot 1 » Add validation to compare values of two fields » 2020-02-20 16:12:00

sergiogarciaruso
Replies: 0

Hi All. I am trying to include in the model validations to compare values from various fields, for example I need field A to be always larger than field B. For this I am implementing a new class inheriting from TSynValidateRest, and eventually using it in the AddFilterOrValidate method. I have defined the parameters to be of the format: FIELD:OPERATOR. For example:
         AddFilterOrValidate('FieldA', TSynValidateNumber.Create('{FieldB:GT}'));
That would mean that the value of FieldA must be greater than that of FieldB.

Is that a valid path, or should I use another solution? What do you recommend?
Greetings
   Sergio

#2 Re: mORMot 1 » It's posible to use multiple connections/models in one REST (Oracle) » 2019-11-01 18:22:31

Hi. When you say "external database mapping" what do you mean? The TSQLRecord classes? Can you give us an example of how to map two tables belonging to two different schemes in Oracle? Thank you for your quick response.
Sergio

#3 mORMot 1 » It's posible to use multiple connections/models in one REST (Oracle) » 2019-11-01 17:43:34

sergiogarciaruso
Replies: 3

Hi all. We already have an Oracle database since ten years ago, and until now our Delphi applications are client/server. Now we want to build a REST server using Mormot, but we have a problem.
In Oracle we have four schemas, and each one have its one tables... How can we model that scenario using Mormot?
Maybe creating four connection (aProps[1] := TSQLDBOracleConnectionProperties.Create() ... aProps[4] := TSQLDBOracleConnectionProperties.Create), and eventually four Models for every connection (aModel[1] := CreateModel1 ... aModel[4] := CreateModel1), using VirtualTableExternalRegisterAll() with each pair? What about REST server where only one model we can use (TSQLRestServerDB.Create(model,...)) ?

I appreciate the help you could give us.

Regards,
   Sergio

#4 Re: mORMot 1 » Using GET return all or some fields and not just the "ID". » 2019-06-25 16:02:50

Thank you for your responses and recommendations. Greetings.

#5 mORMot 1 » Using GET return all or some fields and not just the "ID". » 2019-06-24 19:07:51

sergiogarciaruso
Replies: 9

Hi all. I'm new using Mormot and we're testing it. We would like the "GET" command to return all or some fields and not just the "ID" field. For example:

...
  TTemporada = class(TSQLRecord)
  private
    fCode : string;
  published
   property Code : string index 30 read fCode write fCode;
  end;
...

Request: GET http://localhost:8080/root/temporada

Result:
[
    {
        "ID": 1
    },
    {
        "ID": 2
    }
]

And we'd like to get the following:

[
  {
     "ID": 1,
     "CODIGO": "Cod1"
  },
  {
     "ID": 2,
     "CODIGO": "Cod2"
  }
]

Regards,
    Sergio

Board footer

Powered by FluxBB