develooper Front page | perl.beginners | Postings from December 2002

Need help converting/sorting date field from within a Perl scrip t

Thread Previous | Thread Next
From:
Wendy Stewart
Date:
December 24, 2002 10:37
Subject:
Need help converting/sorting date field from within a Perl scrip t
Message ID:
B7F30EEBD7673244B9BF35ACF382F9A2135DBC@bcmsg011.corp.ads
Hi,

Help!!   I'm a new Perl user and have devloped my first Perl script to
extract fields from a Remedy form into a CSV file to be ftp'd elsewhere.  I
need to sort each record on Modified-date before writing to my output file.
The Modified-date format is in absolute time
(ie:  12/24/2002 7:17:13 PM).  Here's a partial extract of my script:

# The criteria is supposed to included everything modified in the past 1
hour
# which equates to the current time - (60 seconds * 60 minutes).

$SelectQualifier = (ars_LoadQualifier($ctrl, "$SCHEMA", "('Modified-date'
>=(\$TIMESTAMP\$ - 60*60) OR 'Create-date' >= (\$TIMESTAMP
\$ - 60*60))

%entries = ars_GetListEntry($ctrl, "$SCHEMA", $SelectQualifier, 0);
print LOGCHAN "\nError from GetListEntry: ", $ars_errstr;
$ModifiedDate        = ars_GetFieldByName($ctrl, "$SCHEMA",
"Modified-date");
$CreateDate          = ars_GetFieldByName($ctrl, "$SCHEMA", "Create-date");
$USSO_Num            = ars_GetFieldByName($ctrl, "$SCHEMA", "Formatted USSO
#");
$Coordinator_name    = ars_GetFieldByName($ctrl, "$SCHEMA", "CKL_ISC");

# print out the data for each record.
$reccounter=0;
#print ("\n about to enter loop\n");
foreach $entryKey (keys %entries) {
    %vals = ars_GetEntry($ctrl, $SCHEMA, $entryKey);
    printf(DATAOUT "%-15.15s", $vals{$CreateDate})        , ",";
    print DATAOUT $vals{$ModifiedDate}                    , ",";
    print DATAOUT $vals{$USSO_Num}                        , ",";
    print DATAOUT $vals{$Coordinator_name}                , ",";
close(DATAOUT);

#----------------------------------------------------------------------
# Log out of the server.
#----------------------------------------------------------------------
ars_Logoff($ctrl);

#----------------------------------------------------------------------
# Transfer the files to the OEP Host
#----------------------------------------------------------------------
sub FtpDataFile


Note:  I found reference to the following but don't know if it should be
incorporated into the script:   use Shell qw(sort);

Any help would be greatly appreciated.

Thank you,

Wendy Stewart



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About