To filter diagrams by modification date


  1. Create a Generic Table.
  2. Set the Element Type to Diagram. Make sure to select the Include Subtypes check box. Click OK.
  3. Set the Scope where the diagrams will be searched for.
  4. Click the icon in the Scope field and select Custom. The Query dialog opens.
  5. Select Create operation > Filter.

  6. Select Filter > Input > Find.
  7. Set the Type to Diagram
  8. Expand FindScopeContextual Variable.
  9. Select Filter Predicate > Operation from Model > GreaterThanOrEquals.

    If you cannot see the GreaterThanOrEquals operation, make sure the Apply Filter box is not checked.


  10. Select Predicate > Body > A > Script.
  11. From the Language drop-down list, select Groovy.

  12. Insert the following script as the Body:

    Groovy
    import java.text.DateFormat;
    import java.util.Date;
    
    if (arg1) {
    Date date1 = DateFormat.getDateInstance(DateFormat.SHORT).parse(arg1.iterator().next()); 
    }

  13. Select arg1 > Reset.
  14. Select arg1 > Simple Navigation.
  15. Select Modification date and set Is Applied to true.
  16. Select Predicate > Body B > Script.
  17. From the Language drop-down list, select Groovy.

  18. Insert the following script as the Body:

    Groovy
    Date M1 = new Date();
    M1.setMonth(M1.getMonth() - 1);
    M1

  19. Click OK. To view the column, make sure to display it via the Columns button in the diagram toolbar > Select Columns > set the Modification date column to true.

Sample model

The model used in these examples is the Case Studies for Querying the Model sample model. To open this model, you need to download case studies for querying the model.mdzip