Hi there,

I'm trying to use the following query to retrieve data from ARS Remedy

query="'System'="TACT" AND ('Date & Time'>="01/01/2011" AND 'Date & 
Time'<="01/02/2011")"

It returns 0 elements :(

If I use 

query="'System'="TACT" AND 'Date & Time'>="01/01/2011""
or
query="'System'="TACT" AND 'Date & Time'<="01/02/2011"
, it works.

Is there any known limitation that we can't use the same field twice?

CODE:
sub query {

    my ($self,
 %params) = @_;
    my (%record_hash);
    
    # Arguments check (query/schema must be defined)
    die "query: Invalid arguments \n"
        unless ( exists $params{query}  && 
                 exists $params{schema} && 
                 exists $params{fields} );

    # Remedy object wraps ARSperl OO connection (ARS object)
    my $ars_conn = $self->{ars_conn};

    # Store mandatory arguments
    my ($query, $schema, $fields) = @params{'query','schema','fields'};

    # Open a new form (cache fields) returns ARS::form object
    my $form =
 $ars_conn->openForm ( -form => $schema );
    
    # Query Remedy for Record Id's matching criteria 
    my @record_ids = $form->query ( -query => $query );
    
    # Iterate thro' record Id's
    for my $record_id (@record_ids) {
    
        # Query fields for each record ID  
        my @field_values = $form->get ( -entry => $record_id,
                                        -fields => $fields );
    
        # Add field value(s) to record hash (structure) 
        $record_hash{$record_id} = [ @field_values ];
    }

    # Return REF to record hash (structure) 
    return \%record_hash ;
}


$record_hash_ref = $r_conn->query(
        query => $query,
        schema => $schema,
        fields => $fields);


Thanks

Kind regards
 
Bruno Gomes
PT: +351 966 175 401
BE: +32  485 937 881
[email protected]

AVISO
Não imprima esta mensagem. O ambiente agradece. Esta mensagem (incluindo 
quaisquer anexos) pode conter informação confidencial para uso exclusivo do 
destinatário. Se não for o destinatário pretendido, não deverá usar, distribuir 
ou copiar este e-mail. Se recebeu esta mensagem por engano, por favor informe o 
emissor e elimine-a imediatamente. Obrigado.

DISCLAIMER
Do not print this message. The environment thanks you. This e-mail (including 
any attachments) may contain confidential information for exclusive use of its 
recipient. If you are not the intended recipient you must not use, distribute 
or copy this e-mail. If you have received this e-mail in error please notify 
the sender and delete it immediately. Thank You.
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure

--
Arsperl-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/arsperl-users

Reply via email to