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

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?
Thanks guys,
Michael A.

@Feeltheday – sorting tables is not that funny ;-)
Hm. Too lazy? Just a suggestion…
As a starting point look into the following blog posts and scripts:
Peter Kahrel
InDesign: Sort tables | Peter Kahrel
And when it comes to language specific sort:
Language-aware paragraph/line sorter (light) | Peter Kahrel
Here the heavy-lifting:
Language-aware paragraph/line sorter | Peter Kahrel
Marc Autret
Indiscripts :: Alphabetical Sort in JavaScript (and InDesign)
Forum discussion here:
SortParagraphs Rules Do Not Follow Standards
Uwe

Similar Messages

  • Hide sort(ascending and descending) buttons in an alv report.

    Hi,
    I want to hide the  sort(ascending and descending) buttons in an alv report.
    can any one help me with the code?
    I am not able to use the parameter IT_TOOLBAR_EXCLUDING
    of SET_TABLE_FOR_FIRST_DISPLAY of class  CL_GUI_ALV_GRID.
    Regards,
    Himanshu.

    Hi,
    data it_exclude type ui_functions.
    Exclude Standard Functions
        PERFORM f_excludetoolbar USING obj_cust_grid
                              CHANGING it_exclude.
    FORM f_excludetoolbar  USING  u_obj_cust_grid  TYPE REF TO cl_gui_alv_grid
                        CHANGING  c_it_exclude     TYPE ui_functions.
    Exclude Standard Functions
      CLEAR: c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_check              TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_refresh            TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_copy           TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_copy_row       TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_cut            TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_delete_row     TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_append_row     TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_insert_row     TO  c_it_exclude.
      APPEND u_obj_cust_grid->mc_fc_loc_move_row       TO  c_it_exclude.
    APPEND u_obj_cust_grid->MC_FC_SORT_DSC          TO  c_it_exclude.
      APPEND u_obj_cust_grid->MC_FC_SORT_ASC  TO  c_it_exclude.
      APPEND u_obj_cust_grid->MC_FC_SORT           TO  c_it_exclude.*
    ENDFORM.                    " f_excludetoolbar
    Hope it will helpful for you.
    Reward if found helpful.
    Regards,
    SB

  • The formula field is not sorting both ascending and descending

    Dear All,
                   I am designing scoreboard the net amount contains the formula field, i sorted with asceding order by using sort,but it is not sorted both ascending or descending ,
                  Suppose if i used to sort the database field it is sorted properly  so any one help me very urgent
    Regards
    Selva.D
    Edited by: Rui Pereira on Aug 8, 2008 11:32 AM

    Dear Suda,
                     The scoreboard i designed via query print layout. So i calculated  by using formula field ie totalsales- sales return for that i used formula and i follow the below steps
    Choose repetitive area -
    > Right mouse click---> sort
    in the sorting i choose the formula uinque id and i choose Ascending then summary, after i click ok
    Suggest me the solution
    Regards
    Selva.D
    Edited by: Rui Pereira on Jul 8, 2008 5:18 PM

  • Can I turn off grouping by date in Finder and also 'Arrange by' and 'Sort by' in ascending and descending order?

    I am trying to arrange my photostream saved search (which doesn't update automatically after I did the search for the first time which is very annoying) but finder won't let me arrange in ascending order of date (i.e.: oldest to newest). Is there a way I can do this or will my folder arrangements always be the one way without the option to change it to the opposite arrangement (same for alphabetical). Also, Finder automatically arranges my photos into groups of dates (e.g.: 'previous 30 days', 'September'). Is there any way I can turn this off?
    Also if anyone can fix this stupid photostream issue for me that would be great!
    thanks very much 

    Even in list view, the photos are grouped by previous seven days, previous 30 days, October, and so on.. there is no option i see that will let me change to order by date modified without these groupings or to just turn these groupings off altogether
    but thank you for your reply
    -Peelo2311

  • How can I do sorting from ascending to descending then unsort?

    Hi all,
    Can anybody help on this issue?
    I have a bunch of numbers in a table, and I hope when I click the column header once, it will do ascending.
    Click again, do descending. Then click three times, become unsort (which is origially ordered in absolute value).
    I tried to add tree SortKeys in sorter, but it doesn't work:
    List<RowSorter.SortKey> sortKeys = new ArrayList<RowSorter.SortKey>();
    sortKeys.add(new RowSorter.SortKey(2, SortOrder.UNSORTED));      // 2 means it's the 3rd column I want to sort
    sortKeys.add(new RowSorter.SortKey(2, SortOrder.DESCENDING));
    sortKeys.add(new RowSorter.SortKey(2, SortOrder.ASCENDING));
    sorter.setSortKeys(sortKeys);Then I tried to implement my own Comparator, but will always get numbers ordered in absolute value.
            Comparator<Float> comparator = new Comparator<Float>() {
                public int compare(Float s1, Float s2) {
                    if (s1 < 0) s1 *= (-1);
                    if (s2 < 0) s2 *= (-1);
                    return s1.compareTo(s2);   
            sorter.setComparator(2, comparator);      // 2 means it's the 3rd column I want to sortThank you very much indeed in advance.
    Cheers,
    George

    Apologies for not saying it clearly.
    I can easily do ascending and decending by applying this:
            sorter = new TableRowSorter<TableModel>(table.getModel());
            table.setRowSorter(sorter);But I also need my data to be sorted by absolute value. That's why I tried to implement my own Comparator.
    However, it turned out that I will only have one sorting method, which is the absolute value as you have noticed.
    Hence I hope the result, if possible, would be if I first click the column header, ascending orders.
    Click the second time, decending orders. And then click the third time, absolute value orders.
    Cheers

  • ITunes 11 - How do you Sort by Genre then Artist? Other General Customizations

    Hello,
    Maybe somebody else knows how to do this, if so please post it. I am really disappointed in iTunes ever since version 10 I think, where they majorly revamped the whole look for it. No, I am not one of those people who are opposed to change and are slow to adapt when changes are made to applications either. I just feel these new changes majorly suck.
    So I am using version 11, the latest one. Apple has made it so uncustomizable that it is ridiculous. Correct me if I am wrong in saying this, that you can’t do any of this stuff anymore. When I open iTunes I like to be able to select Genres and then have the music within the Genre sorted by artist. I don’t see how you can do this anymore. Now when you click on Genre there is no longer an option to sort anything. Everything is sorted by CD Name and you aren’t allowed to sort it any other way. Seriously, who really knows the name of every CD they own, especially when you have several 100 CDs?
    So if I want to view my music by artist I have to select Artists, which that lists all artists (regardless of genre).  I hate this because then it is harder to find the exact artist you are looking for because the list is that much longer and you are scrolling through a ton more artists just to get to the one you are looking for. Yes, I already know there is a search library feature. I also like viewing the artist by Genre because it is easier to determine if the newly added CD was placed in the correct Genre. I know some people just add music and don’t care where it is placed or how it is organized, but I like to keep it all organized. I even have it organized on my computer by folders Genres, folders Artists, and then folders CDs.
    This is the same for viewing your Playlists. You used to be able to select your playlists and then view a specific genre within that playlist. From there I could sort the playlist however I wanted, like by artists, and then CD. I have several playlists that have more than one genre in it. With this new version you can’t view your playlist by genre, you can only view all of the songs within the playlist.
    I also liked in the old version how you could view the number of songs in each genre. Well, you can still do this once you click on the genre, but there isn’t an overview anymore. Like in the old version it would list all the genres and then in a caption underneath each genre it would show how many songs and different artists are in each genre. There was no need to go into each individual genre to view this information. You could also view the number of songs in each genre within each playlist as well.  The playlist thing has been removed altogether. Now you can only view how many songs are in the playlist, regardless of genre.
    The new version does have a few tiny benefits, like easily being able to see what playlist(s) a particular song is in by right clicking on a song and then selecting Show in Playlists. I however, don’t feel the tiny tweaks outweigh the view customizable benefits of previous versions. These new tweaks could have easily been added to the older versions without disabling the customizable view settings.

    Max OSX 10.6.8, iTunes 11.1
    I had a similar problem: I wanted to synch my playlist to my iphone. I like to have my playlist sorted by genre. But under each genre, albums are not sorted by the track numbers. This is a problem, especially when I am listening to club mixes when the DJ smoothly transitions from 1 track sequentially to the next one. Under the properties of each audio file, the Track Numbers and Disc Numbers are already there.
    My perfect solution was to turn On Sorting - Sort Album under View>Show View Options. Then, select all the songs in that album (Shift click, Cmd click, etc) , and Edit multiple item information (Cmd I). You will see Info-Video-Sorting-Options buttons. Click on Sorting. Then, under Sort Album, Enter the name of the album. Then OK.
    You should now have the playlist sorted by Genre, then each album individually sorted by track numbers. On your playlist you should see, if you scroll right, the column added called "Sort Album".
    Hope this helps.

  • ITunes 11 [Songs view] - Sort on artist, then year

    I just downloaded iTunes 11 and there seem to be some features missing compared to iTunes 10. One of the most important issues is that in the "Songs" view, I cannot seem to sort on (1) Artist and (2) Album year. It seems that iTunes is automatically sorting as (1) Artist, (2) Album name alphabetically. For example, for Norah Jones, first the album Little Broken Hearts (2012) is displayed, and after that the album Not Too Late (2007). Does anyone know if this can still be done in iTunes 11 or is the feature missing completely? Interestingly enough, in the "Albums" view, there is an option to sort by Artist, then Year (view --> view options).
    Another issue, which I believe has been adressed in other topics as well, is the complete missing of albumart in the "Songs" view. Consequently, this was also the place in iTunes 10 where you could choose to sort on Arist/Year. I really hope that Apple puts this feature back in iTunes 11 as soon as possible.

    Yep, I'm seeing the same thing.  Just downloaded iTunes 11 and now I can't sort albums by year in the "Artists" view.  I used to prefix all my album mp3 tag names with the year number to work around this, but removed it when Apple added the Artist/Year sort.  Now it's gone.  Yay!
    A note: you can use the free mp3tag.de software to insert your year tag into your album titles using regular expressions.  If there doesn't seem to be any obvious solution to sorting by Artist/Album/Year in the next couple days, then I'll post here with some tips if anyone is interested.

  • Macbook pro will not start up, press the start button and it sort of clicks then nothing

    Yesterday I remember MBP getting extremly hot. After a bit I opened it up and it did not work. pressing the start button and it sort of clicks then nothing. 

    Go step by step and test.
    Restart.
      http://support.apple.com/kb/ts2570
    Startup in Safe mode
    http://support.apple.com/kb/PH14204?viewlocale=en_US
    Repair Disk
    Steps 1 through 7
    http://support.apple.com/kb/PH5836
    Reset PRAM: http://support.apple.com/kb/ph14222
    Reinstall OS X
    http://support.apple.com/kb/PH13871

  • Want to sort the records based on non-base table item

    I have a multi-record block and I am trying to sort the data based on nbt item
    I have a table called X which has x_type,x_code fields.
    The table on which the block is created is Y. the table Y has x_type and y_desc as its fields
    form layout is like below .the x_type is key field on which I have to query the records
    and x_code is a non-base item in the form.I want to sort the records by X_code.
    x_code y_desc
    A     xyz
    c par
    B     lmn
    my pre-query has this code
    select x_type from y
    where
    x_type := x_type;
    post-query has this code
    select x_code from x
    where x_type = :x_type;     
    It works fine in Enter-Queryand execute query mode. but when I am sorting the records on
    nbt item x_code by SET-BLOCK-PROPERTY it doesn't do any thing

    Hi Tony ,
    I have created a function and in Pre-Query & have add this
    SET_BLOCK_PROPERTY('b1', ORDER_BY, 'fn_get_code(x_type)');
    and the function created is as below
    Function fn_get_code (p_x_type in varchar2) return varchar2 is
    v_code varchar2(40);
    begin
    select x_code into v_code
    from X, Y
    where X.x_type = Y.x_type
    and y.x_type = p_x_type
    return v_code;
    end;
    when I run the form and execute query it comes up with the error message
    FRM-40505 and when I pressed display error it shows
    SQL Statement error:
    SELECT ROWID,X_TYPE,X_CODE
    FROM Y order by fn_get_code(x_type)
    Error:
    "ORA-00904: "FN_GET_code": invalid identifier"
    Is it that I need to create a function on the database?. As I have created function
    in program unit section

  • It takes 8 hours to download the new upgrade for my phone. Then after 8 hours downloading it says sorry there was an interuptions of some sorts. this is rediculous. ive tried 3 times, eating my cap  and still no results.. seriously what must i do?

    It takes 8 hours to download the new upgrade for my phone. Then after 8 hours downloading it says sorry there was an interuptions of some sorts. this is rediculous. ive tried 3 times, eating my cap  and still no results.. seriously what must i do? Been an anyone help....

    Hi there,  thanx for the quick reply.
    Ok the error code after 8 hours of downloading said  error code 9006. I’m not too good withcomputers and I’m really battling with this. And tell me is it really necessary to download update 4.3.3... If I’m having so much trouble it really makes me deponent to try and try again...I have the iphone 4 16 GB  4.3 (8F190) version. Model MC603SO. Itunes10.2.2.14...
    And why does it take 6 – 8 hours?
    Hope you can help
    Kind regrds

  • Create Table using DBMS_SQL package and size not exceeding 64K

    I have a size contraint that my SQL size should not exceed 64K.
    Now I would appriciate if some one could tell me how to create a table using
    Dynamic sql along with usage of DBMS_SQL package.
    Brief Scenario: Users at my site are not given permission to create table.
    I need to write a procedure which the users could use to create a table .ALso my SQL size should not exceed 64K. Once this Procedure is created using DBMS_SQL package ,user should pass the table name to create a table.
    Thanks/

    "If a user doesn't have permission to create a table then how do you expect they will be able to do this"
    Well, it depends on what you want to do. I could write a stored proc that creates a table in my schema and give some other user execute privilege on it. They would then be able to create a able in my schema without any explicitly granted create table privilege.
    Similarly, assuming I have CREATE ANY TABLE granted directly to me, I could write a stroe proc that would create a table in another users schema. As long as they have quota on their default tablespace, they do not need CREATE TABLE privileges.
    SQL> CREATE USER a IDENTIFIED BY a
      2  DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
    User created.
    SQL> GRANT CREATE SESSION TO a;
    Grant succeeded.
    SQL> CREATE TABLE a.t (id NUMBER, descr VARCHAR2(10));
    CREATE TABLE a.t (id NUMBER, descr VARCHAR2(10))
    ERROR at line 1:
    ORA-01950: no privileges on tablespace 'USERS'So, give them quota on the tablespace and try again
    SQL> ALTER USER a QUOTA UNLIMITED ON users;
    User altered.
    SQL> CREATE TABLE a.t (id NUMBER, descr VARCHAR2(10));
    Table created.Now lets see if it really belongs to a:
    SQL> connect a/a
    Connected.
    SQL> SELECT table_name FROM user_tables;
    TABLE_NAME
    T
    SQL> INSERT INTO t VALUES (1, 'One');
    1 row created.Yes, it definitely belongs to a. Just to show that ther is nothing up my sleeve:
    SQL> create table t1 (id NUMBER, descr VARCHAR2(10));
    create table t1 (id NUMBER, descr VARCHAR2(10))
    ERROR at line 1:
    ORA-01031: insufficient privilegesI can almost, but not quite, see a rationale for the second case if you want to enforce some sort of naming or location standards but the whole thing seems odd to me.
    Users cannot create tables, so lets give them a procedure to create tables?
    John

  • Need To Create a table in Sql Server and do some culculation into the table from Oracle and Sql

    Hello All,
    I'm moving a data from Oracle to Sql Server with ETL (80 tables with data) and i want to track the number of records that i moving on the daily basis , so i need to create a table in SQL Server, wilth 4 columns , Table name, OracleRowsCount, SqlRowCount,
    and Diff(OracleRowsCount - SqlRowCount) that will tell me the each table how many rows i have in Oracle, how many rows i have in SQL after ETL load, and different between them, something like that:
    Table Name  OracleRowsCount   SqlRowCount  Diff
    Customer                150                 150            
    0
    Sales                      2000                1998          
    2
    Devisions                 5                       5             
    0
    (I can add alot of SQL Tasks and variables per each table but it not seems logicly to do that, i tryid to find a way to deal with that in vb but i didn't find)
    What the simplest way to do it ?
    Thank you
    Best Regards
    Daniel

    Hi Daniel,
    According to your description, what you want is an indicator to show whether all the rows are inserted to the destination table. To achieve your goal, you can add a Row Count Transformation following the OLE DB Destination, and redirect bad rows to the Row
    Count Transformation. This way, we can get the count of the bad rows without redirecting these rows. Since the row count value is stored in a variable, we can create another string type variable to retrieve the row count value from the variable used by the
    Row Count Transformation, and then use a Send Mail Task to send the row count value in an email message body. You can also insert the row count value to the SQL Server table through Execute SQL Task. Then, you can check whether bad rows were generated in the
    package by querying this table.  
    Regards,
    Mike Yin
    TechNet Community Support

  • Keeping table description on change and not displaying NULL values

    I have the table grouped by BFY and then showing by fund. I can only get the description section to show up for the first fund and then when it changes funds nothing shows up. Then when the year changes again it appears.
    ex.
    BFY: 2005: 0100AXXXXD
    but when the fund changes from 0100AXXXXD........nothing shows up.
    Also I wanted to not include any funds/years that are null. I had the following code in but it isn't stopping the null values.
    <?if: SEC_ZERO_INDICATOR !=0?>
    Thanks for any help.

    Need to see your xml data structure. Can you send me the xml and RTF file to [email protected]? I will take a look.
    Thanks,
    Bipuser

  • Most full featured word processor? (table editing, google docs) and webdav on the ipad

    Hi All,
    So I have had a frustrating time trying to add rows to a table in a word processing document on Google Docs. Are there any word processors that support this? Quickoffice and Documents to Go do not as of this writing. (May 26th, 2011.) at least not that I can determine.
    Does Office2HD support this feature? Do any of the word processors?
    My current thoughts/what Apple needs to do/
    Currently I am thinking about buying Pages and then using Goodreader to open the file in pages, and then saving the pages document to idisk/webdav and then moving it to google docs from idisk/webdav using Goodreader (though it appears you can use Readdledocs too.)
    According to the makers of Docsportal, if Pages supported Open With, I could Open With Docsportal and it would be uploaded. Alternatively, Docsportal could simply add idisk or webdav support, but I can understand why they are waiting for Apple to get their act together.
    Currently, I have discovered that Quickoffice does support mounting quickoffice as a drive as does goodreader. Docs2Go does not support this feature. This is a nice way to get files in and out. The Mac will support WebDAV for the Mac filesystem as of Lion allowing programs like goodreader or readdledocs to connect to it.
    --Sam

    I viewed the Office2HD Help file and it seems to support table creation.
    http://www.bytesquared.com/products/office/ipad/basic.asp?product=office2pro#ins ert_table
    I will post back once I am able to edit a table.
    Office2HD as mentioned elsewhere in this forum supports Google Docs.
    It does also support WebDAV (mounting as an external drive.) The help file mentions that it now allows you to navigate using the cursor or arrow keys.

  • Store data from a table into excel sheet and email

    Hi all,
    I am just wondering, i m not sure where to start. I want to insert data from a table into an excel spread sheet.
    I'm working on a stored procedure with 3 input parameters:
    1. the actual query
    2. userid
    3. the column headers (comma separated) - these will be in the same order as the outer select statement in the query itself. I will use the column headers for the respective columns in Excel worksheet.
    When the proc is executed, the excel is populated. If the record count is > 65536, then I need to create multiple worksheets in the same excel file.
    How can i do that? Can any body please help with this..?

    We are doing like this ( Not sure whether it is the best method available)
    --Get the output of the query (Since the number of columns is not fixed you would have to use dbms_sql package)
    --loop through the output and write into a file, for example test.csv, using UTL_FILE package
    --load the file into a blob variable(we are doing it by loading it into a table)
    --For mailing You can use the below package
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    Mailing code we are using is given below:
    CREATE OR REPLACE procedure xls_mail(
        p_sender     varchar2, -- sender, example: 'Me <[email protected]>'
        p_recipients varchar2, -- recipients, example: 'Someone <[email protected]>'
        p_subject    varchar2, -- subject
         p_text           varchar2, -- text
         p_filename      varchar2, -- name of xls file
         p_blob           blob         -- xls file
    ) is
      conn      utl_smtp.connection;
      i number;
      len number;
    BEGIN
      conn := demo_mail.begin_mail(
        sender     => p_sender,
        recipients => p_recipients,
        subject    => p_subject,
        mime_type  => demo_mail.MULTIPART_MIME_TYPE);
      demo_mail.begin_attachment(
        conn         => conn,
        mime_type    => 'application/xls',
        inline       => TRUE,
        filename     => p_filename,
        transfer_enc => 'base64');
        -- split the Base64 encoded attachment into multiple lines
       i   := 1;
       len := DBMS_LOB.getLength(p_blob);
       WHILE (i < len) LOOP
          IF(i + demo_mail.MAX_BASE64_LINE_WIDTH < len)THEN
             UTL_SMTP.Write_Raw_Data (conn
                                    , UTL_ENCODE.Base64_Encode(
                                            DBMS_LOB.Substr(p_blob, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
          ELSE
             UTL_SMTP.Write_Raw_Data (conn
                                    , UTL_ENCODE.Base64_Encode(
                                            DBMS_LOB.Substr(p_blob, (len - i)+1,  i)));
          END IF;
          UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
          i := i + demo_mail.MAX_BASE64_LINE_WIDTH;
       END LOOP;
      demo_mail.end_attachment(conn => conn);
      demo_mail.attach_text(
        conn      => conn,
        data      => p_text,
        mime_type => 'text/html');
      demo_mail.end_mail( conn => conn );
    END;

Maybe you are looking for