Print Page | Close Window

Aurelius export: no indices

Printed From: TMS Software
Category: Business Tools
Forum Name: Data Modeler
Forum Discription:
URL: http://www.tmssoftware.com/site/forum/forum_posts.asp?TID=8813
Printed Date: 08 Dec 2019 at 11:48am


Topic: Aurelius export: no indices
Posted By: Grobety Stephane
Subject: Aurelius export: no indices
Date Posted: 28 Mar 2018 at 9:56am
Hello,

I have several indices defined in my data structure. Yet, the corresponding DBIndex decoration is missing from all classes exported as Aurelius entities.

Is there a parameter somewhere that governs this behavior ?



Replies:
Posted By: Wagner R. Landgraf
Date Posted: 28 Mar 2018 at 2:29pm
No, DBIndex attribute is not exported by Data Modeler, yet.


Posted By: Grobety Stephane
Date Posted: 28 Mar 2018 at 3:29pm
Thank you for your answer. Any idea when it will be included ?


Posted By: Wagner R. Landgraf
Date Posted: 28 Mar 2018 at 8:18pm
We have it in our huge backlog, but no timeframe set yet. Maybe in a couple of months.


Posted By: Grobety Stephane
Date Posted: 02 Jul 2018 at 3:09pm
Hello,

would it be possible to have an update on the status of this feature ? 

We're moving ahead with our migration of a rather large BDE application (100+ tables) that makes heavy use of indices and creating them manually will be a rather long task: I don't want to spend weeks of work on that if the functionality will be readily available soon (plus, manually adding the index attributes makes it impossible to re-generate the entities).

Thanks


Posted By: Grobety Stephane
Date Posted: 06 Jul 2018 at 8:10am
Could I get an answer to my question, please ?


Posted By: Farias Anderson
Date Posted: 06 Jul 2018 at 4:12pm
I guess you can use the Script tab to implement what you need:

procedure OnClassGenerated(Args: TClassGeneratedArgs);
begin
  { read Args.DBTable.Indexes and write your DBIndex attributes }
end;


Posted By: Grobety Stephane
Date Posted: 06 Jul 2018 at 4:55pm
That is an excellent idea! Thanks


Posted By: Wagner R. Landgraf
Date Posted: 09 Jul 2018 at 11:26pm
Indeed, I simply forgot that you could do that from customization script. That was actually the reason to implement the script: to allow users export more attribute and/or customize generated code, without the need to implement every single feature in Data Modeler.

You can use the following code in customization script to export DBIndex attributes from the existing indexes:

procedure OnClassGenerated(Args: TClassGeneratedArgs);
var                                                    
  I, J: Integer;
  Idx: TGDAOIndex;    
  Fields: string;         
  Attr: TCodeAttributeDeclaration;
begin                                             
  for I := 0 to Args.DBTable.Indexes.Count - 1 do
  begin                                               
    Idx := Args.DBTable.Indexes;
    Fields := '';
    for J := 0 to Idx.IFields.Count - 1 do          
    begin
      if Fields <> '' then Fields := Fields + ',';
      Fields := Fields + Idx.IFields[J].FieldName;
    end;
    Attr := Args.CodeType.AddAttribute('DBIndex');
    Attr.AddRawArgument('''' + Idx.IndexName + '''');
    Attr.AddRawArgument('''' + Fields + '''');
  end;
end;



Print Page | Close Window