wlandgraf
(Wagner Landgraf)
March 15, 2023, 8:57pm
6
Yes, it's possible. There are a few examples in the documentation and here in Support Center that you can use as a base and extend it for your own use.
Example on adding an atribute based on some field information (name):
My beginning of automaticly create a column
procedure OnColumnGenerated(Args: TColumnGeneratedArgs);
begin
if Args.Field.Name = 'FsngCreate' then
Args.Field.AddAttribute( 'Column(''sngCreate'', [])');
end;
procedure OnClassGenerated(Args: TClassGeneratedArgs);
begin
Args.CodeType.AddField( 'FsngCreate', 'TDateTime', mvPrivate);
end;
The FsngCreate field is created, but t…
Adding property/field based on field information:
Thanks Wagner,
One last question: Is there any documentation or source code about these scripts other than datamodeller_manual.pdf? For example TGDAOField.
Also I put the following code into script in order to convert every Date field even if I forget to override in the mappings. But documentation will be very helpful.
procedure OnColumnGenerated(Args: TColumnGeneratedArgs);
begin
if Args.DBField.DataTypeName = 'Date' then
begin
// What about the required fields then this is a wrong ove…
Actually an example of adding validation attributes based on some field information:
Hard to believe.
When I read the new documentation I thought it would naturally lead to a DataModeler upgrade.
It would be far better than mantaining dozens of columns this way:
procedure OnColumnGenerated(Args: TColumnGeneratedArgs);
var
LTipo, LCampo : string;
begin
LTypeName := LowerCase(Args.CodeType.Name);
LFieldName := Lowercase(Args.Field.Name);
if (LTypeName = 'tperson') then begin
if (LFieldNam…
1 Like