A image. My code below is only work for firstpage. Please review the attached code and tell me what did I do wrong here or anyone has any good example to point to. Thanks ================================ select lastname, firstname, t_date, state from view_t_report order by #sort#
Name   Sort by Last Name Ascending    Sort by Last Name Descending T_Date   Sort by T_Date Ascending    Sort by T_Date Descending State
#UCASE(lastname)#,#Ucase(firstname)# #Ucase(middlename)# #dateformat(t_date,'mm/dd/yyy')# #status#
[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => kt03 [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 5 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> Sort - Adobe Indesign Windows

Sort - Adobe Indesign Windows

Hi, I want to write a perl script to do something like this Abc 12.8 8 "left" 1 15.7 Def 13.8 9 "top" 0 19.7 gef 14.8 9 "left" 0 19.7 Dgf 12.3 9 "right" 4 99.6 cef 16.8 4 "right" 0 89.7 baf 32.8 7 "bottom" 5 79.8 efg 16.8 5 "right" 0 56.7 etg 12.8 2 "left" 7 34.7 Just say I want to sort the row based on the value on fifth or third column, any advice how to do so? Thank you & best regards, ABC...

  1. #1

    Default sort

    Hi,

    I want to write a perl script to do something like this



    Abc 12.8 8 "left" 1 15.7

    Def 13.8 9 "top" 0 19.7

    gef 14.8 9 "left" 0 19.7

    Dgf 12.3 9 "right" 4 99.6

    cef 16.8 4 "right" 0 89.7

    baf 32.8 7 "bottom" 5 79.8

    efg 16.8 5 "right" 0 56.7

    etg 12.8 2 "left" 7 34.7





    Just say I want to sort the row based on the value on fifth or third column, any advice how to do so?





    Thank you & best regards,

    ABC




    Boon Chong Ang Guest

  2. #2

    Default RE: sort

    I have to run, otherwise I would elaborate a bit.

    The code is below. Check out the "perldoc perlreftut" for what the
    "\cols", "{$row}", and "$a->[2]" means. Check out "perldoc -f sort" for
    what the "sort {...} rows" means. And of course ask questions if you get
    stuck (but take a look at the docs first).

    ############ THE CODE ############

    my rows;

    while (my $line = <DATA>) {
    chomp($line);
    my cols = split(/\s+/, $line);
    push rows, \cols;
    }

    print "Sorted on 5th column:\n";
    rows = sort {$a->[4] <=> $b->[4]} rows;

    foreach my $row (rows) {
    print "{$row}\n";
    }

    print "Sorted on 3rd column:\n";
    rows = sort {$a->[2] <=> $b->[2]} rows;

    foreach my $row (rows) {
    print "{$row}\n";
    }

    __DATA__
    Abc 12.8 8 "left" 1 15.7
    Def 13.8 9 "top" 0 19.7
    gef 14.8 9 "left" 0 19.7
    Dgf 12.3 9 "right" 4 99.6
    cef 16.8 4 "right" 0 89.7
    baf 32.8 7 "bottom" 5 79.8
    efg 16.8 5 "right" 0 56.7
    etg 12.8 2 "left" 7 34.7

    ############ THE OUTPUT ############

    $ perl sort.pl
    Sorted on 5th column:
    efg 16.8 5 "right" 0 56.7
    Def 13.8 9 "top" 0 19.7
    gef 14.8 9 "left" 0 19.7
    cef 16.8 4 "right" 0 89.7
    Abc 12.8 8 "left" 1 15.7
    Dgf 12.3 9 "right" 4 99.6
    baf 32.8 7 "bottom" 5 79.8
    etg 12.8 2 "left" 7 34.7
    Sorted on 3rd column:
    etg 12.8 2 "left" 7 34.7
    cef 16.8 4 "right" 0 89.7
    efg 16.8 5 "right" 0 56.7
    baf 32.8 7 "bottom" 5 79.8
    Abc 12.8 8 "left" 1 15.7
    Dgf 12.3 9 "right" 4 99.6
    Def 13.8 9 "top" 0 19.7
    gef 14.8 9 "left" 0 19.7


    -----Original Message-----
    From: Boon Chong Ang [mailto:BCANGaltera.com]
    Sent: Thursday, January 29, 2004 7:38 PM
    To: [email]beginnersperl.org[/email]
    Subject: sort


    Hi,

    I want to write a perl script to do something like this



    Abc 12.8 8 "left" 1 15.7

    Def 13.8 9 "top" 0 19.7

    gef 14.8 9 "left" 0 19.7

    Dgf 12.3 9 "right" 4 99.6

    cef 16.8 4 "right" 0 89.7

    baf 32.8 7 "bottom" 5 79.8

    efg 16.8 5 "right" 0 56.7

    etg 12.8 2 "left" 7 34.7





    Just say I want to sort the row based on the value on fifth or third column,
    any advice how to do so?





    Thank you & best regards,

    ABC



    Rob Hanson Guest

  3. #3

    Default Sort

    Does anyone know if there is a way to sort alphabetically in InDesign using the Windows platform?

    Do you need to write special scripting for it?
    Trevor_Slette@adobeforums.com Guest

  4. #4

    Default Re: Sort

    Hi Trevor--

    There's a script on your InDesign CD (or on the first extras CD, if you're using the Creative Suite set) called SortParagraphs.js that might do what you want. It's very slow with large amounts of text, but works well when you need to sort 50 or fewer paragraphs.

    Thanks,

    Ole
    Olav_Kvern@adobeforums.com Guest

  5. #5

    Default sort

    I have the report.cfm page to display all the record from the database. On the
    column header for NAME and T_date I want able to give the user option to sort
    by NAME for ascending or descending OR sort by T_date for ascending or
    descending by click on the little A->Z or Z-->A image. My code below is only
    work for firstpage. Please review the attached code and tell me what did I do
    wrong here or anyone has any good example to point to.

    Thanks
    ================================


    <CFPARAM NAME="sort" default="1 desc">

    <cfquery name="get_distance_name" datasource="#db#">
    select lastname, firstname, t_date, state
    from view_t_report
    order by #sort#
    </cfquery>

    <cfset OnEachPage=50>
    <cfset NumPages=Ceiling(get_distance_name.RecordCount / OnEachPage)>
    <table width="700" cellpadding="0" cellspacing="0" border="1">
    <cfoutput>
    <tr>
    <th width="255" scope="col" class="r_text">Name&nbsp;&nbsp;
    <a href="report.cfm?sort=#URLEncodedFormat("1
    asc")#&PageNum=#DecrementValue(PageNum)#"><img src="../images/ascending.gif"
    alt="Sort by Last Name Ascending" border="0" ></a>
    &nbsp;&nbsp;&nbsp;<a href="terminations.cfm?sort=#URLEncodedFormat("1
    desc")#"><img src="../images/descending.gif" alt="Sort by Last Name Descending"
    border="0" ></a>
    </th>
    <th width="260" scope="col" class="r_text">T_Date&nbsp;&nbsp;
    <a href="report.cfm?sort=#URLEncodedFormat("2 asc")#"><img
    src="../images/ascending.gif" alt="Sort by T_Date Ascending" border="0" ></a>
    &nbsp;&nbsp;&nbsp;<a href="terminations.cfm?sort=#URLEncodedFormat("2
    desc")#"><img src="../images/descending.gif" alt="Sort by T_Date Descending"
    border="0" ></a>
    </th>
    <th width="64" scope="col" class="r_text">State</th>
    </tr>
    </cfoutput>

    <tr>
    <td scope="row" class="#class1#">#UCASE(lastname)#,#Ucase(firstnam e)#
    #Ucase(middlename)#</td>
    <td class="#class1#">#dateformat(t_date,'mm/dd/yyy')#</td>
    <td class="#class1#">#status#</td>
    </tr>
    </cfoutput>
    </table>

    kt03 Guest

Similar Threads

  1. [ANN] Sort::Key 0.02
    By Salvador Fandino in forum PERL Modules
    Replies: 1
    Last Post: April 28th, 05:39 PM
  2. Sort a ds
    By vishal in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: January 20th, 11:21 AM
  3. memory sort and disk sort
    By dusong in forum Informix
    Replies: 4
    Last Post: October 24th, 02:11 PM
  4. Replies: 1
    Last Post: September 9th, 07:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •