Ver Mensaje Individual
  #14  
Antiguo 27-08-2010
Avatar de julyus
julyus julyus is offline
Miembro
 
Registrado: jul 2006
Ubicación: IN TO PLACES COLOMBIA AND EE.UU
Posts: 121
Reputación: 18
julyus Va por buen camino
Talking segunda pregunta

eficsa gracias por tu explicacion me ayudo mucho el tema y un poco de ver codigo basico

ahora tengo otra pregunta cree dentro de esta funcion que retorna un array tipo variant otro array para irle asignando unos valores en los campos
mi pregunta es el array ListArray es igual de tipo variant no se si debo crearlo asi
i:interger
i = 0;
....
ListArray[i] := valor;
i := i +1

para ir incrementado la posicion que solo tiene un valor

ver parte del código

Código Delphi [-]
function TFMListenerService.GetEventCodeArray(cIOElement : TIOElement): TArrayList;
var
i:integer;
ADOSP : TADOStoredProc;
Conn: Iconnection;
sVehicleId, iCompanyId : string;
Factor, AccelDecel, iCurrSpeed : double;
ListArray : TArrayList; //para ir acumulando  listado array que de sebe regresar de la funcion
begin

  //rrecorrido de eventos
  //try
     if (cIOElement.ElementEvent.iEventIOId = 0) then  //No hay evento significativo
      begin

        // Se verifica Conexion Desconexion
         if cIOElement.ElementValue(66) >= 6000 then
         begin
             ListArray[i] := 24;//System Connect.

         end
         else
         Begin
             ListArray[i] := 25; //System Disconnect.

         end;
        //----------------------------------------------------------------------

        //Se verifica si hay evento de Boton de Panico

        if cIOElement.ElementValue(1) =1 then
        begin
            ListArray[i] := 31 // Alert Button

        end;
        //----------------------------------------------------------------------


        //Se debe verificar si el vehiculo está encendido.
        if cIOElement.ElementValue(10) >= 2000 then

        begin
          if cIOElement.ElementValue(240) = 0 then //Si no está en movimiento
            ListArray[i] := 3 //Time Passed
          else
            ListArray[i] := 4; //Distance Passed
         end;
         //----------------------------------------------------------------------

         //iCurrSpeed := cIOElement.ElementEvent.aElements[0];
         //----------------------------------------------------------------------
         //
         try
         Conn := ConnPool.GetConnection;
         //ejecuto el storeprocedure
         ADOSP.Connection := Conn.Connection; // paso el string de conexion
         ADOSP.ProcedureName := 'GetOverRpm'; // pongo el nombre del SP que voy a utilizar
         ADOSP.Parameters.Refresh; // creo los parametros que espera el SP
         ADOSP.Parameters.ParamByName('@CompanyId').Value  := iCompanyId;
         ADOSP.Parameters.ParamByName('@CarNumber').Value  := sVehicleId;
         ADOSP.Parameters.ParamByName('@Factor').Value  := Factor;
         ADOSP.Parameters.ParamByName('@EventType').Direction := pdInputOutput;
         ADOSP.Parameters.ParamByName('@EventCode').Direction :=  pdInputOutput;
         ADOSP.Open;
         factor:= pdInputOutput[0];

         finally
         ADOSP.Close;
         ADOSP.Free;
         end;
        //asigno a el arreglo

        if cIOElement.ElementValue(11) = 0 then //Si no está en movimiento
         begin
           ListArray[i] := 21 //OverRpm

          //----------------------------------------------------------------------
         end;
       Result:= ListArray;
Responder Con Cita