Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 24-08-2010
Avatar de julyus
julyus julyus is offline
Miembro
 
Registrado: jul 2006
Ubicación: IN TO PLACES COLOMBIA AND EE.UU
Posts: 121
Poder: 18
julyus Va por buen camino
Exclamation hola amigo por la ayuda

la duda que me queda es si miras los campos que envio tienen tipo, el
array es de tipo string esto me daria errores?
ahora lo que quiero es lo siguiente NewArrayData es un array que va a recibir los resultados de SearchEvents el resultado del array lo voy a pasar a este para hacer un ulitimo proceso
Código Delphi [-]
NewArrayData := SearchEvents(sIMEI, iCompanyId, sVehicleId,
            iCurrSpeed,iCurrRPM,iAccDeccValue,
            bDIN1, bDIN2, bDIN3, bDIN4,
            fAIN1, fAIN2,  fAIN3, fAIN4,
            iGSMSignal, iCurrentProfile ,
            fAcelerometerData, fGPSSpeed,  fPowerSuplyVoltage, fBatteryVoltage, fBatteryCurrent,
            fGPSPower, fPCBTemperature, fTempSensor1, fTempSensor2,
            fTempSensor3, fFuelCounter, sButtonInput, fCan0, fCan1,
            fCan2, fCan3, fCan4, fCan5, fCan6, fCan7, fCan8,  fCan9,
            bGeoZone1, bGeoZone2, bGeoZone3,
            bGeoZone4, bGeoZone5, bGeoZone6, bGeoZone7,
            bGeoZone8, bGeoZone9, bGeoZone10, bGeoZone11,
            bGeoZone12, bGeoZone13, bGeoZone14, bGeoZone15,
            bGeoZone16, bGeoZone17, bGeoZone18, bGeoZone19, bGeoZone20,
fVirtualOdometer, sCurrOperatorCode, bMovement); gracias por tu tiempo
Responder Con Cita
  #2  
Antiguo 24-08-2010
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
No tenés nada que agradecer.

A ver si con esto solucionamos algo...
Código Delphi [-]
type
  RecSearchEvents = record
    sIMEI: string;
    iCompanyId : integer;
    sVehicleId : string;
    iCurrSpeed,iCurrRPM,iAccDeccValue :integer;
    bDIN1, bDIN2, bDIN3, bDIN4 : Boolean;
    fAIN1, fAIN2,  fAIN3, fAIN4 : Extended;
    iGSMSignal, iCurrentProfile : integer;
    fAcelerometerData, fGPSSpeed,  fPowerSuplyVoltage,
    fBatteryVoltage, fBatteryCurrent, fGPSPower, fPCBTemperature,
    fTempSensor1, fTempSensor2, fTempSensor3, fFuelCounter,
    sButtonInput, fCan0, fCan1, fCan2, fCan3, fCan4, fCan5,
    fCan6, fCan7, fCan8,  fCan9 : Extended;
    bGeoZone1, bGeoZone2, bGeoZone3,
    bGeoZone4, bGeoZone5, bGeoZone6, bGeoZone7,
    bGeoZone8, bGeoZone9, bGeoZone10, bGeoZone11,
    bGeoZone12, bGeoZone13, bGeoZone14, bGeoZone15,
    bGeoZone16, bGeoZone17, bGeoZone18, bGeoZone19,
    bGeoZone20 : Boolean;
    fVirtualOdometer : string;
    sCurrOperatorCode : Extended;
    bMovement : Bool
  end;
  TForm1 = class(TForm)
  private
  public
    function SearchEvents(Param: RecSearchEvents): RecSearchEvents;
  end;


var
  Form1: TForm1;

implementation {$R *.dfm}

function TForm1.SearchEvents(Param: RecSearchEvents): RecSearchEvents;
begin
   // Operaciones de la funcion
  Result:= Param;
end;

En este caso pasas y recibis un RecSearchEvents. (o el nombre que quieras darle)
Tenés que cargar los valores en el record antes de llamar a la función por ej:
Código Delphi [-]
var
  rs:RecSearchEvents;
begin
  rs.sIMEI:= '1934102937340';
  rs.iCompanyID:= 11234; 
  ...
  rs:= SearchEvents(rs); // rs, ahora tiene los valores procesados en la función
end;

Nota: No es necesario, pero al ser tantos campos para una mayor claridad quizá te convenga
declarar el registro así:
Código Delphi [-]
  RecSearchEvents = record
    sIMEI: string;
    iCompanyId : integer;
    sVehicleId : string;
    iCurrSpeed, iCurrRPM, iAccDeccValue :integer;
    bDIN: array[1..4] of Boolean;
    bAIN: array[1..4] of Extended;
    iGSMSignal, iCurrentProfile : integer;
    fAcelerometerData, fGPSSpeed,  fPowerSuplyVoltage,
    fBatteryVoltage, fBatteryCurrent, fGPSPower, fPCBTemperature,
    fTempSensor1, fTempSensor2, fTempSensor3, fFuelCounter,
    sButtonInput: Extended;
    fCan: array[0..9] of Extended;
    bGeoZone: array[1..20] of Boolean;
    fVirtualOdometer : string;
    sCurrOperatorCode : Extended;
    bMovement : Bool
  end;

Es mas o ménos lo que buscabas ?

Saludos.

Última edición por ecfisa fecha: 24-08-2010 a las 21:42:37.
Responder Con Cita
  #3  
Antiguo 25-08-2010
Avatar de julyus
julyus julyus is offline
Miembro
 
Registrado: jul 2006
Ubicación: IN TO PLACES COLOMBIA AND EE.UU
Posts: 121
Poder: 18
julyus Va por buen camino
Unhappy script completo

te lo voy a explicar mejor tengo una funcion lacual recibe estos parameros y devuelve un booleano
dentro de esta funcion envian un array "cAVLDataFM4" luego se debe descomponer en varables para un query update

mi primer paso es pasar a variables luego enviarlas a mi funtion array
evaluo y luego le paso el retorno de mi funtion array a un array final
para hacer un insert te preguntaras para que mi funtion array me generara mas rows para mi array final luego con eso hare el insert es por cuestion de manejo que se hace eso mi duda ahora es como paso el resultado de mi funcion a un nuevo array ??

aca es donde estoy usando lo que te he preguntado eficsa
Código Delphi [-]
function TFMListenerService.UpdateCurrentVehicleData(sIMEI: string;
         cAVLDataFM4: TAVLDataFM4;
         iCompanyId : integer;
         sVehicleId : string;
         iMessageId : integer;
         dCurrOdometer : Double;
         var sErrMess: string): boolean;
var

  iCount: Integer;
  bDIN1,bDIN2,bDIN3,bDIN4 : Boolean;
  fAIN1,fAIN2,fAIN3,fAIN4 : Extended;
  iGSMSignal,iCurrentProfile : integer;
  fAcelerometerData, fGPSSpeed, fPowerSuplyVoltage,
  fBatteryVoltage, fBatteryCurrent,
  fGPSPower, fPCBTemperature,
  fTempSensor1,fTempSensor2,fTempSensor3,
  fFuelCounter,
  fCan0,fCan1,fCan2,fCan3,fCan4,fCan5,fCan6,
  fCan7,fCan8,fCan9,fVirtualOdometer : Extended;
  bGeoZone1,bGeoZone2,bGeoZone3,bGeoZone4,bGeoZone5,
  bGeoZone6,bGeoZone7,bGeoZone8,bGeoZone9,bGeoZone10,
  bGeoZone11,bGeoZone12,bGeoZone13,bGeoZone14,bGeoZone15,
  bGeoZone16,bGeoZone17,bGeoZone18,bGeoZone19,bGeoZone20 : Boolean;
  sButtonInput, sCurrOperatorCode,
  sTimeZone,sParams : string;
  bMovement : Boolean;
  Conn: IConnection;
  sqlQuery : TADOQuery;
  sdUTCPosTimeStamp, sdLocalPosTimeStamp : TSystemTime;
  tTimeZone : TTimeZoneInformation;
  dPositionDate,dPositionTime : TDateTime;
  iEventCode,iHeading,
  iDriveType,iNeedService,
  iCurrSpeed,iCurrRPM,
  iAccDeccValue,iSatellites,
  iHardwareVer,iSoftVer,
  iBateryLevel : integer;
  sDriverId,sChargeId,sGPSsStatus,sEventInfo : string;
  dLatitude,dLongitude : Double;
  NewArrayData :TNewArrayData;
begin
  Result := False;
  try
    sqlQuery := TADOQuery.Create(Self);
    try
      Conn := ConnPool.GetConnection;
      sqlQuery.Connection := Conn.Connection;

      for iCount := 0 to cAVLDataFM4.NumberOfData - 1 do
      begin
        bDIN1 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(1) = 1);
        bDIN2 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(2) = 1);
        bDIN3 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(3) = 1);
        bDIN4 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(4) = 1);
        fAIN1 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(9);
        fAIN2 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(10);
        fAIN3 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(11);
        fAIN4 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(19);
        iGSMSignal := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(21);
        iCurrentProfile := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(22);
        fAcelerometerData := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(23);
        fGPSSpeed := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(24);
        fPowerSuplyVoltage := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(66);
        fBatteryVoltage := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(67);
        fBatteryCurrent := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(68);
        fGPSPower := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(69);
        fPCBTemperature := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(70);
        fTempSensor1 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(72);
        fTempSensor2 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(73);
        fTempSensor3 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(74);
        fFuelCounter := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(76);
        sButtonInput := IntToStr(cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(78));
        fCan0 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(145);
        fCan1 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(146);
        fCan2 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(147);
        fCan3 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(148);
        fCan4 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(149);
        fCan5 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(150);
        fCan6 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(151);
        fCan7 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(152);
        fCan8 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(153);
        fCan9 := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(154);
        bGeoZone1 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(155) = 1);
        bGeoZone2 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(156) = 1);
        bGeoZone3 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(157) = 1);
        bGeoZone4 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(158) = 1);
        bGeoZone5 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(159) = 1);
        bGeoZone6 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(160) = 1);
        bGeoZone7 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(161) = 1);
        bGeoZone8 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(162) = 1);
        bGeoZone9 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(163) = 1);
        bGeoZone10 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(164) = 1);
        bGeoZone11 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(165) = 1);
        bGeoZone12 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(166) = 1);
        bGeoZone13 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(167) = 1);
        bGeoZone14 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(168) = 1);
        bGeoZone15 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(169) = 1);
        bGeoZone16 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(170) = 1);
        bGeoZone17 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(171) = 1);
        bGeoZone18 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(172) = 1);
        bGeoZone19 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(173) = 1);
        bGeoZone20 := (cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(174) = 1);
        fVirtualOdometer := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(199); //Metros
        sCurrOperatorCode := IntToStr(cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(241));
        bMovement := cAVLDataFM4.AVLDataArray[iCount].IOData.ElementValue(240) = 1;

        dPositionDate := DateOf(cAVLDataFM4.AVLDataArray[iCount].TimeStamp);
        dPositionTime := TimeOf(cAVLDataFM4.AVLDataArray[iCount].TimeStamp);

        //  Se obtienen los Eventos Basicos
        iEventCode:= GetEventCode(cAVLDataFM4.AVLDataArray[iCount].IOData);

        // Envio de datos al elvaluador de Eventos
        //Retorno los datos del evaluador a otro arreglo
        NewArrayData := SearchEvents(sIMEI, iCompanyId, sVehicleId,
            iCurrSpeed,iCurrRPM,iAccDeccValue,
            bDIN1, bDIN2, bDIN3, bDIN4,
            fAIN1, fAIN2,  fAIN3, fAIN4,
            iGSMSignal, iCurrentProfile ,
            fAcelerometerData, fGPSSpeed,  fPowerSuplyVoltage, fBatteryVoltage, fBatteryCurrent,
            fGPSPower, fPCBTemperature, fTempSensor1, fTempSensor2,
            fTempSensor3, fFuelCounter, sButtonInput, fCan0, fCan1,
            fCan2, fCan3, fCan4, fCan5, fCan6, fCan7, fCan8,  fCan9,
            bGeoZone1, bGeoZone2, bGeoZone3,
            bGeoZone4, bGeoZone5, bGeoZone6, bGeoZone7,
            bGeoZone8, bGeoZone9, bGeoZone10, bGeoZone11,
            bGeoZone12, bGeoZone13, bGeoZone14, bGeoZone15,
            bGeoZone16, bGeoZone17, bGeoZone18, bGeoZone19, bGeoZone20,
            fVirtualOdometer, sCurrOperatorCode, bMovement);


        sqlQuery.SQL.Text := 'UPDATE [IMEIDataServices] WITH (ROWLOCK) ' +
        'SET [LastTx] = :LastTx ' +
        ',[MessageId] = :MessageId ' +
        ',[Moving] = :Moving ' +
        ',[Connected] = :Connected ' +
        ',[DIN1] = IN1 ' +
        ',[DIN2] = IN2 ' +
        ',[DIN3] = IN3 ' +
        ',[DIN4] = IN4 ' +
        ',[AIN1] = :AIN1 ' +
        ',[AIN2] = :AIN2 ' +
        ',[AIN3] = :AIN3 ' +
        ',[AIN4] = :AIN4 ' +
        ',[GSMSignalStrength] = :GSMSignalStrength ' +
        ',[CurrentProfile] = :CurrentProfile ' +
        ',[AcelerometerData] = :AcelerometerData ' +
        ',[GPSSpeed] = :GPSSpeed ' +
        ',[PowerSupplyVoltage] = :PowerSupplyVoltage ' +
        ',[BatteryVoltage] = :BatteryVoltage ' +
        ',[BatteryCurrent] = :BatteryCurrent ' +
        ',[GPSPower] = :GPSPower ' +
        ',[PCBTemperature] = :PCBTemperature ' +
        ',[TemperatureSensor1] = :TemperatureSensor1 ' +
        ',[TemperatureSensor2] = :TemperatureSensor2 ' +
        ',[TemperatureSensor3] = :TemperatureSensor3 ' +
        ',[FuelCounter] = isnull([FuelCounter],0) + :FuelCounter ' +
        ',[iButtonInput] = :iButtonInput ' +
        ',[CAN0] = :CAN0 ' +
        ',[CAN1] = :CAN1 ' +
        ',[CAN2] = :CAN2 ' +
        ',[CAN3] = :CAN3 ' +
        ',[CAN4] = :CAN4 ' +
        ',[CAN5] = :CAN5 ' +
        ',[CAN6] = :CAN6 ' +
        ',[CAN7] = :CAN7 ' +
        ',[CAN8] = :CAN8 ' +
        ',[CAN9] = :CAN9  ' +
        ',[GeoZone1] = :GeoZone1 ' +
        ',[GeoZone2] = :GeoZone2 ' +
        ',[GeoZone3] = :GeoZone3 ' +
        ',[GeoZone4] = :GeoZone4 ' +
        ',[GeoZone5] = :GeoZone5 ' +
        ',[GeoZone6] = :GeoZone6 ' +
        ',[GeoZone7] = :GeoZone7 ' +
        ',[GeoZone8] = :GeoZone8 ' +
        ',[GeoZone9] = :GeoZone9 ' +
        ',[GeoZone10] = :GeoZone10 ' +
        ',[GeoZone11] = :GeoZone11 ' +
        ',[GeoZone12] = :GeoZone12 ' +
        ',[GeoZone13] = :GeoZone13 ' +
        ',[GeoZone14] = :GeoZone14 ' +
        ',[GeoZone15] = :GeoZone15 ' +
        ',[GeoZone16] = :GeoZone16 ' +
        ',[GeoZone17] = :GeoZone17 ' +
        ',[GeoZone18] = :GeoZone18 ' +
        ',[GeoZone19] = :GeoZone19 ' +
        ',[GeoZone20] = :GeoZone20 ' +
        ',[VirtualOdometer] = :VirtualOdometer ' +
        ',[CurrentOperatorCode] = :CurrentOperatorCode ' +
        'WHERE [IMEI] = :Imei';

        sqlQuery.Parameters.ParamByName('Imei').Value := sIMEI;
        sqlQuery.Parameters.ParamByName('LastTx').Value := Now;
        sqlQuery.Parameters.ParamByName('MessageId').Value := iMessageId;
        sqlQuery.Parameters.ParamByName('Moving').Value := bMovement;
        sqlQuery.Parameters.ParamByName('Connected').Value := True;
        sqlQuery.Parameters.ParamByName('DIN1').Value := bDIN1;
        sqlQuery.Parameters.ParamByName('DIN2').Value := bDIN2;
        sqlQuery.Parameters.ParamByName('DIN3').Value := bDIN3;
        sqlQuery.Parameters.ParamByName('DIN4').Value := bDIN4;
        sqlQuery.Parameters.ParamByName('AIN1').Value := fAIN1;
        sqlQuery.Parameters.ParamByName('AIN2').Value := fAIN2;
        sqlQuery.Parameters.ParamByName('AIN3').Value := fAIN3;
        sqlQuery.Parameters.ParamByName('AIN4').Value := fAIN4;
        sqlQuery.Parameters.ParamByName('GSMSignalStrength').Value := iGSMSignal;
        sqlQuery.Parameters.ParamByName('CurrentProfile').Value := iCurrentProfile;
        sqlQuery.Parameters.ParamByName('AcelerometerData').Value := fAcelerometerData;
        sqlQuery.Parameters.ParamByName('GPSSpeed').Value := fGPSSpeed;
        sqlQuery.Parameters.ParamByName('PowerSupplyVoltage').Value := fPowerSuplyVoltage;
        sqlQuery.Parameters.ParamByName('BatteryVoltage').Value := fBatteryVoltage;
        sqlQuery.Parameters.ParamByName('BatteryCurrent').Value := fBatteryCurrent;
        sqlQuery.Parameters.ParamByName('GPSPower').Value := fGPSPower;
        sqlQuery.Parameters.ParamByName('PCBTemperature').Value := fPCBTemperature;
        sqlQuery.Parameters.ParamByName('TemperatureSensor1').Value := fTempSensor1;
        sqlQuery.Parameters.ParamByName('TemperatureSensor2').Value := fTempSensor2;
        sqlQuery.Parameters.ParamByName('TemperatureSensor3').Value := fTempSensor3;
        sqlQuery.Parameters.ParamByName('FuelCounter').Value := fFuelCounter;
        sqlQuery.Parameters.ParamByName('iButtonInput').Value := sButtonInput;
        sqlQuery.Parameters.ParamByName('CAN0').Value := fCan0;
        sqlQuery.Parameters.ParamByName('CAN1').Value := fCan1;
        sqlQuery.Parameters.ParamByName('CAN2').Value := fCan2;
        sqlQuery.Parameters.ParamByName('CAN3').Value := fCan3;
        sqlQuery.Parameters.ParamByName('CAN4').Value := fCan4;
        sqlQuery.Parameters.ParamByName('CAN5').Value := fCan5;
        sqlQuery.Parameters.ParamByName('CAN6').Value := fCan6;
        sqlQuery.Parameters.ParamByName('CAN7').Value := fCan7;
        sqlQuery.Parameters.ParamByName('CAN8').Value := fCan8;
        sqlQuery.Parameters.ParamByName('CAN9').Value := fCan9;
        sqlQuery.Parameters.ParamByName('GeoZone1').Value := bGeoZone1;
        sqlQuery.Parameters.ParamByName('GeoZone2').Value := bGeoZone2;
        sqlQuery.Parameters.ParamByName('GeoZone3').Value := bGeoZone3;
        sqlQuery.Parameters.ParamByName('GeoZone4').Value := bGeoZone4;
        sqlQuery.Parameters.ParamByName('GeoZone5').Value := bGeoZone5;
        sqlQuery.Parameters.ParamByName('GeoZone6').Value := bGeoZone6;
        sqlQuery.Parameters.ParamByName('GeoZone7').Value := bGeoZone7;
        sqlQuery.Parameters.ParamByName('GeoZone8').Value := bGeoZone8;
        sqlQuery.Parameters.ParamByName('GeoZone9').Value := bGeoZone9;
        sqlQuery.Parameters.ParamByName('GeoZone10').Value := bGeoZone10;
        sqlQuery.Parameters.ParamByName('GeoZone11').Value := bGeoZone11;
        sqlQuery.Parameters.ParamByName('GeoZone12').Value := bGeoZone12;
        sqlQuery.Parameters.ParamByName('GeoZone13').Value := bGeoZone13;
        sqlQuery.Parameters.ParamByName('GeoZone14').Value := bGeoZone14;
        sqlQuery.Parameters.ParamByName('GeoZone15').Value := bGeoZone15;
        sqlQuery.Parameters.ParamByName('GeoZone16').Value := bGeoZone16;
        sqlQuery.Parameters.ParamByName('GeoZone17').Value := bGeoZone17;
        sqlQuery.Parameters.ParamByName('GeoZone18').Value := bGeoZone18;
        sqlQuery.Parameters.ParamByName('GeoZone19').Value := bGeoZone19;
        sqlQuery.Parameters.ParamByName('GeoZone20').Value := bGeoZone20;
        sqlQuery.Parameters.ParamByName('VirtualOdometer').Value := dCurrOdometer;
        sqlQuery.Parameters.ParamByName('CurrentOperatorCode').Value := sCurrOperatorCode;
        sqlQuery.ExecSQL;

       if iEventCode > -1 then
        begin
          if not InsertTrip(iCompanyId, sVehicleId,
                iMessageId, dPositionDate,
                dPositionTime, iEventCode,
                sDriverId, sChargeId,
                sGPSsStatus, dLatitude,
                dLongitude, iHeading, iDriveType,
                iNeedService,
                (dCurrOdometer / 1000), //Kilometros
                iCurrSpeed, iCurrRPM,
                iAccDeccValue, iSatellites,
                iHardwareVer, iSoftVer, iBateryLevel,fAIN4,
                sEventInfo, sErrMess) then
          begin
            WriteLog(1,'ERR',0,sVehicleId,sErrMess);
          end;
        end
        else
        begin
          WriteLog(4,'INF',0,'0','Vehicle turned off, record was not inserted');
        end;
      end;
      Result := true;
    finally
      sqlQuery.Free;
      //sqlCommand.Free;
      //sqlConn.Close;
      //sqlConn.Free;
    end;
  except
    on e: Exception do
    begin
      sErrMess :=  'Error in UpdateCurrentVehicleData ' + e.Message;
    end;
  end;
end;
Responder Con Cita
  #4  
Antiguo 25-08-2010
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola julyus.

Confieso que me había embarullado un poco con el tema, ahora que veo la función mucho más .

Pero me doy cuenta que quizá la respuesta sea más sencilla de lo que pensé...

Por que tu preguntas es esta no ?
Cita:
Empezado por julyus Ver Mensaje
la duda que me queda es si miras los campos que envio tienen tipo, el array es de tipo string esto me daria errores?
Y sobre eso ya te puedo dar una respuesta y es: Si, te vá a dar error cuando quieras hacer la asignación.

Pero podrías intentar con un arreglo de tipo Variant, es decir reemplazar:
Código Delphi [-]
type
    TEventslistArray = array[0..58] of string;

Por:
Código Delphi [-]
type
   TEventsListArray = array[0..58] of Variant;
El tipo Variant te admite cualquier tipo de variable.

Espero que te sirva.

Saludos .

Última edición por ecfisa fecha: 25-08-2010 a las 03:03:02.
Responder Con Cita
  #5  
Antiguo 25-08-2010
Avatar de julyus
julyus julyus is offline
Miembro
 
Registrado: jul 2006
Ubicación: IN TO PLACES COLOMBIA AND EE.UU
Posts: 121
Poder: 18
julyus Va por buen camino
hola eficsa gracias por tu colaboracion

todavia tengo una duda o un error cunado compilo me sale un error incompatible types extended and string ???
Responder Con Cita
  #6  
Antiguo 25-08-2010
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola julyus.

Con los tipo Variant podes hacer lo siguiente:
Código Delphi [-]
var
  va: Variant;
  ext: Extended;
  str: string;
begin
   ext:= 3.141592654;
   str:= 'Número PI';
   va:= ext; 
   str:= va; 
   ShowMessage(str); 
end;

¿ En que parte del código te salta el error ?

Saludos.
Responder Con Cita
  #7  
Antiguo 25-08-2010
Avatar de julyus
julyus julyus is offline
Miembro
 
Registrado: jul 2006
Ubicación: IN TO PLACES COLOMBIA AND EE.UU
Posts: 121
Poder: 18
julyus Va por buen camino
este es el codigo mas o menos

aqui es donde llamo el array para pasarlo a otro array creo que esta mal
la sintaxis de como hacerlo


Código Delphi [-]
type
    TEventslistArray = array[0..58] of variant;
    TNewArrayData = array[0..58] of variant;

declaracion de la funcion
Código Delphi [-]
 function SearchEvents(sIMEI: string; iCompanyId : integer;  sVehicleId : string;
            iCurrSpeed,iCurrRPM,iAccDeccValue :integer;
            bDIN1, bDIN2, bDIN3, bDIN4 : Boolean;
            fAIN1, fAIN2,  fAIN3, fAIN4 : Extended;
            iGSMSignal, iCurrentProfile : integer;
            fAcelerometerData, fGPSSpeed,  fPowerSuplyVoltage, fBatteryVoltage, fBatteryCurrent,
            fGPSPower, fPCBTemperature, fTempSensor1, fTempSensor2,
            fTempSensor3, fFuelCounter, sButtonInput, fCan0, fCan1,
            fCan2, fCan3, fCan4, fCan5, fCan6, fCan7, fCan8,  fCan9 : Extended;
            bGeoZone1, bGeoZone2, bGeoZone3,
            bGeoZone4, bGeoZone5, bGeoZone6, bGeoZone7,
            bGeoZone8, bGeoZone9, bGeoZone10, bGeoZone11,
            bGeoZone12, bGeoZone13, bGeoZone14, bGeoZone15,
            bGeoZone16, bGeoZone17, bGeoZone18, bGeoZone19, bGeoZone20 : Boolean;
            fVirtualOdometer : Extended; sCurrOperatorCode : string; bMovement : Bool ) :TEventslistArray;

funcion

uso de la funcion aqui es donde me marca el error
Código Delphi [-]

  NewArrayData := SearchEvents(sIMEI, iCompanyId, sVehicleId,
            iCurrSpeed,iCurrRPM,iAccDeccValue,
            bDIN1, bDIN2, bDIN3, bDIN4,
            fAIN1, fAIN2,  fAIN3, fAIN4,
            iGSMSignal, iCurrentProfile ,
            fAcelerometerData, fGPSSpeed,  fPowerSuplyVoltage, fBatteryVoltage, fBatteryCurrent,
            fGPSPower, fPCBTemperature, fTempSensor1, fTempSensor2,
            fTempSensor3, fFuelCounter, sButtonInput, fCan0, fCan1,
            fCan2, fCan3, fCan4, fCan5, fCan6, fCan7, fCan8,  fCan9,
            bGeoZone1, bGeoZone2, bGeoZone3,
            bGeoZone4, bGeoZone5, bGeoZone6, bGeoZone7,
            bGeoZone8, bGeoZone9, bGeoZone10, bGeoZone11,
            bGeoZone12, bGeoZone13, bGeoZone14, bGeoZone15,
            bGeoZone16, bGeoZone17, bGeoZone18, bGeoZone19, bGeoZone20,
            fVirtualOdometer, sCurrOperatorCode, bMovement);

la funcion no esta terminada lo que quiero de esta funcion es que me ingrese unos datos y si hay unos casos cumplidos me genere un array con
el registro primero ingresado y luego los casos cunplidos me generelos unos
nuevos rows repetidos solo con los casos cumplidos afectaran unas variables y generaran un nuevo row

ejemplo

a,b,c insert row en el array

entran a b y c
si c = 0 se evaluan
si c= o tonces escribe a,b y c= '123' en el array
fin

si c= 1
si c= o tonces escribe a,b y c= '321' en el array a regresar

alfinal

deben quedarme 3 rows
1 original
2 cambiado
3 cambiado

fin de la funcion


Código Delphi [-]
function TFMListenerService.SearchEvents(sIMEI: string; iCompanyId : integer;  sVehicleId : string;
            iCurrSpeed,iCurrRPM,iAccDeccValue :integer;
            bDIN1, bDIN2, bDIN3, bDIN4 : Boolean;
            fAIN1, fAIN2,  fAIN3, fAIN4 : string;
            iGSMSignal, iCurrentProfile : integer;
            fAcelerometerData, fGPSSpeed,  fPowerSuplyVoltage, fBatteryVoltage, fBatteryCurrent,
            fGPSPower, fPCBTemperature, fTempSensor1, fTempSensor2,
            fTempSensor3, fFuelCounter, sButtonInput, fCan0, fCan1,
            fCan2, fCan3, fCan4, fCan5, fCan6, fCan7, fCan8,  fCan9 : string;
            bGeoZone1, bGeoZone2, bGeoZone3,
            bGeoZone4, bGeoZone5, bGeoZone6, bGeoZone7,
            bGeoZone8, bGeoZone9, bGeoZone10, bGeoZone11,
            bGeoZone12, bGeoZone13, bGeoZone14, bGeoZone15,
            bGeoZone16, bGeoZone17, bGeoZone18, bGeoZone19, bGeoZone20 : Boolean;
            fVirtualOdometer : string; sCurrOperatorCode : string; bMovement : Bool ) :TEventslistArray;
var
count : integer;
Conn: IConnection;
sqlQuery : TADOQuery;
ADOSP: TADOStoredProc;
EvenType : string;
EvenCode  : integer;
begin




  // consulto datos
  if iCurrSpeed then
  begin

  //ejecuto el storeprocedure
  ADOSP.Connection := Conn; // paso el string de conexion
  ADOSP.ProcedureName := 'GetOverSpeed'; // 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('@Speed').Value  := iCurrSpeed;
  ADOSP.Parameters.ParamByName('@EventType').Direction := EvenType;
  ADOSP.Parameters.ParamByName('@EventCode').Direction :=  EvenCode;


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


  ADOSP.Connection := Conn; // 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  := iCurrSpeed;
  ADOSP.Parameters.ParamByName('@EventType').Direction := EvenType;
  ADOSP.Parameters.ParamByName('@EventCode').Direction := EvenCode;
  //consuto datos


  if iCurrRPM   then
  begin

  end;
  //asigno a el arreglo


  ADOSP.Connection := Conn; // paso el string de conexion
  ADOSP.ProcedureName := 'GetOverSpeed'; // 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('@AccelDecel').Value  := iCurrSpeed;
  ADOSP.Parameters.ParamByName('@EventType').Direction := EvenType;
  ADOSP.Parameters.ParamByName('@EventCode').Direction :=  EvenCode;
  //consulto
  if iAccDeccValue then
  begin

  end;
  //asigno a el arreglo


end;
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Cosulta de BDF no regresa nada eduardo_2009 Tablas planas 3 21-08-2007 15:00:49
??que regresa un query?? david duarte Tablas planas 5 22-05-2006 17:04:53
Funcion SUM me regresa una cadena paty_rlopez Firebird e Interbase 6 18-04-2006 15:13:10
SQLClientDataSet no regresa lo esperado EITB OOP 2 27-09-2004 18:45:25
Como devuelvo un Arreglo en Función Prophoenix Varios 1 30-05-2003 19:40:58


La franja horaria es GMT +2. Ahora son las 16:28:02.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi