4 Replies Latest reply on Jun 5, 2014 11:31 PM by Laubender

    Sorting by "x" then by "y" my table (multiple criterias ascending and descending)

    Feeltheday

      Hi,

       

      I converted some text to a table using this:

      function ConvertoTable(){

      var myStory = app.selection[0].parentStory;

      var myTexts = myStory.texts[0];

      //We now can convert that "texts" object to a table:

      //Both arguments are separated by a "comma"

      myTexts.convertToTable("\t","\r");}

       

      I will always have the same kind of data with 3 columns, one with a mark/value, then a name, then a description.

      I need to sort my table first by the first column in descending order (99 to 90) and then by name in ascending order(A to Z).

      I will then export this table once it's sorted again as a text but it's an another story .

      I know that you can do it through Indesign but I would want to automate it. My javascript is really rusted and I've just started to play with the greps and the scripts within Indesign...so I was hoping someone could help me to achieve that?

       

      erk.jpg

       

      Thanks guys,

      Michael A.