Book a Demo

Author Topic: Export diagram filters  (Read 4610 times)

carolin.boeckler

  • EA User
  • **
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Export diagram filters
« on: April 27, 2016, 08:55:31 pm »
Hello,

I need a possibility to export diagram filters and import them to other projects or to insert my diagram filters in my own MDG technology.
I couldn’t find anything on EA website and also not in the forum.
I already wrote an EA Java Script, but it work also not perfectly cause of the sign ‘ (ASCII-Code 0039 bzw 0x27).
 
How is it possible to copy diagram filters from one project to another?

Caro

Example:

!INC Local Scripts.EAConstants-JScript

/*
 * Script Name:
 * Author:
 * Purpose:
 * Date:
 */
 
function main()
{
      Session.Output("SQL");
   
      insert="INSERT INTO t_xrefsystem (XrefID,Name,Type,Client) VALUES ('{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}','filtertest','DFilter','boeckcro')";
      Repository.Execute(insert);
      Session.Output("insert finished");
      update1="UPDATE t_xrefsystem SET [Description]='<RootSearch><Search Name=\"filtertest\" GUID=\"{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}\" PkgGUID=\"-1\" Type=\"0\" LnksToObj=\"0\" CustomSearch=\"0\" AddinAndMethodName=\"\">' WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(update1);
      update2="UPDATE t_xrefsystem SET [Description]=[Description]+'<SrchOn><RootTable Type=\"0\"><TableName Display=\"Element\" Name=\"t_object\"/><TableHierarchy Display=\"\" Hierarchy=\"t_object\"/>' WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(update2);
      a="xx11xx"; // here is the problem ' instead of xx11xx does not work
      update3="UPDATE t_xrefsystem SET [Description]=[Description]+'<Field Filter=\"t_object.Alias Like ' WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(update3);
      
   
      update3a="UPDATE t_xrefsystem SET [Description]=[Description]+'"+a+"' WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(update3a);
      
   
      update3b="UPDATE t_xrefsystem SET [Description]=[Description]+'*fs*' WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(update3b);
      
      update3c="UPDATE t_xrefsystem SET [Description]=[Description]+'"+a+"' WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(update3c);
      
      update3d="UPDATE t_xrefsystem SET [Description]=[Description]+'\" Text=\"fs\" IsDateField=\"0\" Type=\"1\" Required=\"1\" Active=\"1\">' WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(update3d);
       update4="UPDATE t_xrefsystem SET [Description]=[Description]+'<TableName Display=\"Element\" Name=\"t_object\"/><TableHierarchy Display=\"Element\" Hierarchy=\"t_object\"/><Condition Display=\"Contains\" Type=\"Like\"/>' WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(update4);

       update5="UPDATE t_xrefsystem SET [Description]=[Description]+'<FieldName Display=\"Alias\" Name=\"t_object.Alias\"/></Field></RootTable></SrchOn><LnksTo/></Search></RootSearch>' WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(update5);
   
   
   
   
   /*
       delete1="DELETE FROM t_xrefsystem WHERE [XrefID]='{4DCF4B69-CD40-496e-9D89-F9E3C6511F0D}'";
      Repository.Execute(delete1);   
   */
   Session.Output("update1 finished");
}

main();

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Export diagram filters
« Reply #1 on: April 28, 2016, 07:47:06 pm »
Hello Caro,

I don't know how to export it. I would export it by script to *.xml and then import it. Of course generate a new GUID. With *.xml you have to take care of special characters.

To test the principles I would make a copy of the t_xrefsystem sentence (a very simple filter for the first step) with a new filter name and GUID. Just a SQL select and insert all columns (take care of name and GUID of course). Then I would look if it works (I can assign it to another diagram and I get what I expect). Next step is export and import.

Regarding your error: Can you explain it a bit more?

I would add the SQL inside an Addin. In my opinion the debug possibilities are much better.

If you find a way it would be a good idea to publish it.

Regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)