Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Sum sqlite
Qt 6.11 is out! See what's new in the release blog

Sum sqlite

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
3 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    filipdns
    wrote on last edited by
    #1

    I'm trying to use the sum(temps_bloc_etape) to have the result in the heurecellule column.

    I try to do heurecellule = sum(temps_bloc_etape) and I got result = undefined

    <!-- begin snippet: js hide: false console: true babel: false -->

    <!-- language: lang-js -->

    function dbGetHandle()
    {
        try {
            var db = LocalStorage.openDatabaseSync("Kardex", "1.0", "Kardex", 1000000)
        } catch (err) {
            console.log("Error opening database: " + err)
        }
        return db
    }
    
    function dbUpdateflightlog( Pimmatriculation, Pdate_etape, Ppilot1, Ppilot2, Ppilot3, Pphoto1, Pphoto2, Pphoto3, Paeroport_depart, Paeroport_arrivee, Pheure_depart, Pheure_arrivee, Ptemps_bloc_etape, Prowid)
    {
        var db = dbGetHandle()
        db.transaction(function (tx) {
            tx.executeSql(
                        'update flight_log set immatriculation=?, date_etape=?, pilot1=?,  pilot2=?,  pilot3=?,  photo1=?,  photo2=?,  photo3=?,  aeroport_depart=?,  aeroport_arrivee=?,  heure_depart=?, heure_arrivee=?,  temps_bloc_etape=? where rowid = ? ', [Pimmatriculation, Pdate_etape, Ppilot1, Ppilot2, Ppilot3, Pphoto1, Pphoto2, Pphoto3, Paeroport_depart, Paeroport_arrivee, Pheure_depart, Pheure_arrivee, Ptemps_bloc_etape,Prowid
    }
    
    function dbReadAllflightlog()
    {
        var db = dbGetHandle()
        db.transaction(function (tx) {
            var results = tx.executeSql(
                        'SELECT  rowid, immatriculation, date_etape, pilot1,  pilot2,  pilot3,  photo1,  photo2,  photo3,  aeroport_depart,  aeroport_arrivee,  heure_depart, heure_arrivee,  temps_bloc_etape,  cycle_etape, aircrafttype,numerodeserie,dateconstruction,numerocertificatimmat,numerocertificatLSA,dateLSA,numeroCDN,dateCDN,datecertificatassurance,datepesee,marquemoteur,modelmoteur,marquehelice,modelhelice,serialmoteur1,serialmoteur2,serialhelice1,serialhelice2,heurecellule,cyclecellule,heure_SN_moteur_1,heure_SO_moteur_1,heure_SH_moteur_1,cycle_SN_moteur_1,cycle_SO_moteur_1,cycle_SH_moteur_1,heure_SN_moteur_2,heure_SO_moteur_2,heure_SH_moteur_2,cycle_SN_moteur_2,cycle_SO_moteur_2,cycle_SH_moteur_2,heure_SO_helice_1,cycle_SO_helice_1,heure_SO_helice_2,cycle_SO_helice_2 FROM flight_log order by rowid desc')
            for (var i = 0; i < results.rows.length; i++) {
                listModel.append({
                                     id: results.rows.item(i).rowid,
                                     checked: " ",
                                     immatriculation: results.rows.item(i).immatriculation,
                                     date_etape:results.rows.item(i).date_etape,
                                     pilot1:results.rows.item(i).pilot1,
                                     pilot2:results.rows.item(i).pilot2,
                                     pilot3:results.rows.item(i).pilot3,
                                     photo1:results.rows.item(i).photo1,
                                     photo2:results.rows.item(i).photo2,
                                     photo3:results.rows.item(i).photo3,
                                     aeroport_depart:results.rows.item(i).aeroport_depart,
                                     aeroport_arrivee:results.rows.item(i).aeroport_arrivee,
                                     heure_depart:results.rows.item(i).heure_depart,
                                     heure_arrivee:results.rows.item(i).heure_arrivee,
                                     temps_bloc_etape:results.rows.item(i).temps_bloc_etape,
                                     cycle_etape:results.rows.item(i).cycle_etape,
                                     aircrafttype: results.rows.item(i).aircrafttype,
                                     numerodeserie: results.rows.item(i).numerodeserie,
                                     dateconstruction: results.rows.item(i).dateconstruction,
                                     numerocertificatimmat: results.rows.item(i).numerocertificatimmat,
                                     numerocertificatLSA: results.rows.item(i).numerocertificatLSA,
                                     dateLSA: results.rows.item(i).dateLSA,
                                     numeroCDN: results.rows.item(i).numeroCDN,
                                     dateCDN: results.rows.item(i).dateCDN,
                                     datecertificatassurance: results.rows.item(i).datecertificatassurance,
                                     datepesee: results.rows.item(i).datepesee,
                                     marquemoteur: results.rows.item(i).marquemoteur,
                                     modelmoteur: results.rows.item(i).modelmoteur,
                                     marquehelice: results.rows.item(i).marquehelice,
                                     modelhelice: results.rows.item(i).modelhelice,
                                     serialmoteur1: results.rows.item(i).serialmoteur1,
                                     serialmoteur2: results.rows.item(i).serialmoteur2,
                                     serialhelice1: results.rows.item(i).serialhelice1,
                                     serialhelice2: results.rows.item(i).serialhelice2,
                                     heurecellule: results.rows.item(i).heurecellule,
                                     cyclecellule: results.rows.item(i).cyclecellule,
                                     heure_SN_moteur_1: results.rows.item(i).heure_SN_moteur_1,
                                     heure_SO_moteur_1: results.rows.item(i).heure_SO_moteur_1,
                                     heure_SH_moteur_1: results.rows.item(i).heure_SH_moteur_1,
                                     cycle_SN_moteur_1: results.rows.item(i).cycle_SN_moteur_1,
                                     cycle_SO_moteur_1: results.rows.item(i).cycle_SO_moteur_1,
                                     cycle_SH_moteur_1: results.rows.item(i).cycle_SH_moteur_1,
                                     heure_SN_moteur_2: results.rows.item(i).heure_SN_moteur_2,
                                     heure_SO_moteur_2: results.rows.item(i).heure_SO_moteur_2,
                                     heure_SH_moteur_2: results.rows.item(i).heure_SH_moteur_2,
                                     cycle_SN_moteur_2: results.rows.item(i).cycle_SN_moteur_2,
                                     cycle_SO_moteur_2: results.rows.item(i).cycle_SO_moteur_2,
                                     cycle_SH_moteur_2: results.rows.item(i).cycle_SH_moteur_2,
                                     heure_SO_helice_1: results.rows.item(i).heure_SO_helice_1,
                                     cycle_SO_helice_1:results.rows.item(i).cycle_SO_helice_1,
                                     heure_SO_helice_2: results.rows.item(i).heure_SO_helice_2,
                                     cycle_SO_helice_2:results.rows.item(i).cycle_SO_helice_2,
    
    
                                 })
            }
        })
    }
    

    <!-- end snippet -->

    JonBJ 1 Reply Last reply
    0
    • F filipdns

      I'm trying to use the sum(temps_bloc_etape) to have the result in the heurecellule column.

      I try to do heurecellule = sum(temps_bloc_etape) and I got result = undefined

      <!-- begin snippet: js hide: false console: true babel: false -->

      <!-- language: lang-js -->

      function dbGetHandle()
      {
          try {
              var db = LocalStorage.openDatabaseSync("Kardex", "1.0", "Kardex", 1000000)
          } catch (err) {
              console.log("Error opening database: " + err)
          }
          return db
      }
      
      function dbUpdateflightlog( Pimmatriculation, Pdate_etape, Ppilot1, Ppilot2, Ppilot3, Pphoto1, Pphoto2, Pphoto3, Paeroport_depart, Paeroport_arrivee, Pheure_depart, Pheure_arrivee, Ptemps_bloc_etape, Prowid)
      {
          var db = dbGetHandle()
          db.transaction(function (tx) {
              tx.executeSql(
                          'update flight_log set immatriculation=?, date_etape=?, pilot1=?,  pilot2=?,  pilot3=?,  photo1=?,  photo2=?,  photo3=?,  aeroport_depart=?,  aeroport_arrivee=?,  heure_depart=?, heure_arrivee=?,  temps_bloc_etape=? where rowid = ? ', [Pimmatriculation, Pdate_etape, Ppilot1, Ppilot2, Ppilot3, Pphoto1, Pphoto2, Pphoto3, Paeroport_depart, Paeroport_arrivee, Pheure_depart, Pheure_arrivee, Ptemps_bloc_etape,Prowid
      }
      
      function dbReadAllflightlog()
      {
          var db = dbGetHandle()
          db.transaction(function (tx) {
              var results = tx.executeSql(
                          'SELECT  rowid, immatriculation, date_etape, pilot1,  pilot2,  pilot3,  photo1,  photo2,  photo3,  aeroport_depart,  aeroport_arrivee,  heure_depart, heure_arrivee,  temps_bloc_etape,  cycle_etape, aircrafttype,numerodeserie,dateconstruction,numerocertificatimmat,numerocertificatLSA,dateLSA,numeroCDN,dateCDN,datecertificatassurance,datepesee,marquemoteur,modelmoteur,marquehelice,modelhelice,serialmoteur1,serialmoteur2,serialhelice1,serialhelice2,heurecellule,cyclecellule,heure_SN_moteur_1,heure_SO_moteur_1,heure_SH_moteur_1,cycle_SN_moteur_1,cycle_SO_moteur_1,cycle_SH_moteur_1,heure_SN_moteur_2,heure_SO_moteur_2,heure_SH_moteur_2,cycle_SN_moteur_2,cycle_SO_moteur_2,cycle_SH_moteur_2,heure_SO_helice_1,cycle_SO_helice_1,heure_SO_helice_2,cycle_SO_helice_2 FROM flight_log order by rowid desc')
              for (var i = 0; i < results.rows.length; i++) {
                  listModel.append({
                                       id: results.rows.item(i).rowid,
                                       checked: " ",
                                       immatriculation: results.rows.item(i).immatriculation,
                                       date_etape:results.rows.item(i).date_etape,
                                       pilot1:results.rows.item(i).pilot1,
                                       pilot2:results.rows.item(i).pilot2,
                                       pilot3:results.rows.item(i).pilot3,
                                       photo1:results.rows.item(i).photo1,
                                       photo2:results.rows.item(i).photo2,
                                       photo3:results.rows.item(i).photo3,
                                       aeroport_depart:results.rows.item(i).aeroport_depart,
                                       aeroport_arrivee:results.rows.item(i).aeroport_arrivee,
                                       heure_depart:results.rows.item(i).heure_depart,
                                       heure_arrivee:results.rows.item(i).heure_arrivee,
                                       temps_bloc_etape:results.rows.item(i).temps_bloc_etape,
                                       cycle_etape:results.rows.item(i).cycle_etape,
                                       aircrafttype: results.rows.item(i).aircrafttype,
                                       numerodeserie: results.rows.item(i).numerodeserie,
                                       dateconstruction: results.rows.item(i).dateconstruction,
                                       numerocertificatimmat: results.rows.item(i).numerocertificatimmat,
                                       numerocertificatLSA: results.rows.item(i).numerocertificatLSA,
                                       dateLSA: results.rows.item(i).dateLSA,
                                       numeroCDN: results.rows.item(i).numeroCDN,
                                       dateCDN: results.rows.item(i).dateCDN,
                                       datecertificatassurance: results.rows.item(i).datecertificatassurance,
                                       datepesee: results.rows.item(i).datepesee,
                                       marquemoteur: results.rows.item(i).marquemoteur,
                                       modelmoteur: results.rows.item(i).modelmoteur,
                                       marquehelice: results.rows.item(i).marquehelice,
                                       modelhelice: results.rows.item(i).modelhelice,
                                       serialmoteur1: results.rows.item(i).serialmoteur1,
                                       serialmoteur2: results.rows.item(i).serialmoteur2,
                                       serialhelice1: results.rows.item(i).serialhelice1,
                                       serialhelice2: results.rows.item(i).serialhelice2,
                                       heurecellule: results.rows.item(i).heurecellule,
                                       cyclecellule: results.rows.item(i).cyclecellule,
                                       heure_SN_moteur_1: results.rows.item(i).heure_SN_moteur_1,
                                       heure_SO_moteur_1: results.rows.item(i).heure_SO_moteur_1,
                                       heure_SH_moteur_1: results.rows.item(i).heure_SH_moteur_1,
                                       cycle_SN_moteur_1: results.rows.item(i).cycle_SN_moteur_1,
                                       cycle_SO_moteur_1: results.rows.item(i).cycle_SO_moteur_1,
                                       cycle_SH_moteur_1: results.rows.item(i).cycle_SH_moteur_1,
                                       heure_SN_moteur_2: results.rows.item(i).heure_SN_moteur_2,
                                       heure_SO_moteur_2: results.rows.item(i).heure_SO_moteur_2,
                                       heure_SH_moteur_2: results.rows.item(i).heure_SH_moteur_2,
                                       cycle_SN_moteur_2: results.rows.item(i).cycle_SN_moteur_2,
                                       cycle_SO_moteur_2: results.rows.item(i).cycle_SO_moteur_2,
                                       cycle_SH_moteur_2: results.rows.item(i).cycle_SH_moteur_2,
                                       heure_SO_helice_1: results.rows.item(i).heure_SO_helice_1,
                                       cycle_SO_helice_1:results.rows.item(i).cycle_SO_helice_1,
                                       heure_SO_helice_2: results.rows.item(i).heure_SO_helice_2,
                                       cycle_SO_helice_2:results.rows.item(i).cycle_SO_helice_2,
      
      
                                   })
              }
          })
      }
      

      <!-- end snippet -->

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @filipdns
      I do not see use of sum() anywhere in your code.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        filipdns
        wrote on last edited by
        #3

        yes it was the question, how to do

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved