Comments (5)
For example, how to ignore this fields with null. Example, fields of type Integer, I don't put in sql of insert/update when is equal the null.
Below done, but I don't set the column with a value, because the field is null.
procedure TPessoaModel.SetWs_map_id(const Value: Integer);
begin
if Value>0 then
FWs_map_id := Value
else
FWs_map_id := 1; //But I don't put it !!!
end;
from delphimvcframework.
from delphimvcframework.
You could use a "sentinel" value and postprocess the generated json and substitute such sentinel value with null. You can also use the JSONAction in the Mapper.ObjectsListToJSONArray()
method.
from delphimvcframework.
I solved with code below:
procedure TPessoaService.Update(Model: TPessoaModel);
var
Cmd: TFDCustomCommand;
i:Integer;
objetoLista: TObjectList<TPessoaModel>;
r: tjsonarray;
begin
Model.CheckUpdate;
Cmd := FDM.updPessoas.Commands[arUpdate];
Mapper.ObjectToFDParameters(Cmd.Params, Model, 'NEW_');
Cmd.ParamByName('OLD_ID').AsInteger := Model.ID;
//Check foreigns values = 0 (here is the solution)
if cmd.Params.ParamValues['NEW_WS_MAP_ID']=0 then
cmd.Params.ParamByName('NEW_WS_MAP_ID').Clear();
if cmd.Params.ParamValues['NEW_SEGMENTO_ID']=0 then
cmd.Params.ParamByName('NEW_SEGMENTO_ID').Clear();
Cmd.Execute;
if Cmd.RowsAffected <> 1 then
raise Exception.Create('Registro não encontrado!');
end;
from delphimvcframework.
from delphimvcframework.
Related Issues (20)
- Middleware for Content Security Policy (CSP) Headers HOT 2
- Deserialiser for URLEncoded Body HOT 5
- Can I use MVCFramework.HTTPSys.Core.pas in Milestone 3.4? HOT 1
- Helpers for HTMX HOT 7
- Using Spring4D Collections in ViewData HOT 18
- TMVCActiveRecordMiddleware error - Object factory for class is missing HOT 1
- SelectByNamedQuery created exception when using with Microsoft SQL Server HOT 2
- Add option to the wizard to configure mustache engine HOT 6
- TMVCActiveRecordController - refresh=true
- Packages for older versions contains bad includes section
- [HOW TO] Running on another port - via commandline switch. HOT 2
- Character % doesn't work in URL anymore HOT 6
- Request for crud sample using ADO HOT 2
- [htmx-sample] Rename all the class helper method with an "HX" suffix to avoid confusion
- Add "MVCFromContentField" attribute
- Embeded e-Mail Sending System feature request
- JSON Serializing floating point properties. HOT 8
- Nested Mustache Partials Rendering HOT 4
- Error: No mapping for the Unicode character exists in the target multi-byte code HOT 4
- The TUserPasswordChecker class does not exist HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delphimvcframework.