Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QtRpt report from Databse
Forum Updated to NodeBB v4.3 + New Features

QtRpt report from Databse

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qt creatordatabaseqtrpt
13 Posts 7 Posters 4.4k Views 2 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    QtRPT is not an official Qt module, so you should try contacting its author or use their forum.

    In any case, you should also explain exactly what you are expecting and what you are getting.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    ali-aydinA 1 Reply Last reply
    2
    • N Offline
      N Offline
      Neel 0
      wrote on last edited by
      #3

      Hello,
      This problem is solved.

      here is the right code.

      void MainWindow::on_btnGenrateReport_clicked()
      {
          QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
          db.setDatabaseName("/home/gtek/Work/validscan_proj/validscan_db");
          if(!db.open())
          {
              qDebug()<<"Database not Open"<<endl;
          }
          else
          {
              QSqlQuery  qry;
              qry.prepare("select * from vs_channel");
              if(!qry.exec())
              {
                  qDebug()<<"Error in Query"<<endl;
              }
              else
              {
                  QtRPT *report = new QtRPT(this);
                  while(qry.next())
                  {
                     p = new pojo();
                     p->setChannel_id(qry.value(12).toString());
                     p->setChannel_tag(qry.value(1).toString());
                     p->setUnit(qry.value(6).toString());
      
                      plist.push_back(p);
                 }
      
                  report->loadReport(":/chreport.xml");
                  report->recordCount.append(plist.count());
                 
      
                 connect(report,&QtRPT::setValue,[&](const int recNo,
                              const QString paramName, QVariant &paramValue, const int reportPage)
                  {
                      (void) reportPage;
                      if(paramName=="channel_id")
                      {
                          paramValue=plist[recNo]->getChannel_id();
      
                      }
                      if(paramName=="channel_tag")
                      {
                          paramValue=plist[recNo]->getChannel_tag();
                      }
                      if(paramName=="unit")
                      {
                          paramValue=plist[recNo]->getUnit();
                      }
      
                  });
      
                
      
                  report->printExec();
              }
      
          }
      }
      

      I had created one pojo class for getter setter method.

      M Ketan__Patel__0011K 2 Replies Last reply
      1
      • N Neel 0

        Hello,
        This problem is solved.

        here is the right code.

        void MainWindow::on_btnGenrateReport_clicked()
        {
            QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
            db.setDatabaseName("/home/gtek/Work/validscan_proj/validscan_db");
            if(!db.open())
            {
                qDebug()<<"Database not Open"<<endl;
            }
            else
            {
                QSqlQuery  qry;
                qry.prepare("select * from vs_channel");
                if(!qry.exec())
                {
                    qDebug()<<"Error in Query"<<endl;
                }
                else
                {
                    QtRPT *report = new QtRPT(this);
                    while(qry.next())
                    {
                       p = new pojo();
                       p->setChannel_id(qry.value(12).toString());
                       p->setChannel_tag(qry.value(1).toString());
                       p->setUnit(qry.value(6).toString());
        
                        plist.push_back(p);
                   }
        
                    report->loadReport(":/chreport.xml");
                    report->recordCount.append(plist.count());
                   
        
                   connect(report,&QtRPT::setValue,[&](const int recNo,
                                const QString paramName, QVariant &paramValue, const int reportPage)
                    {
                        (void) reportPage;
                        if(paramName=="channel_id")
                        {
                            paramValue=plist[recNo]->getChannel_id();
        
                        }
                        if(paramName=="channel_tag")
                        {
                            paramValue=plist[recNo]->getChannel_tag();
                        }
                        if(paramName=="unit")
                        {
                            paramValue=plist[recNo]->getUnit();
                        }
        
                    });
        
                  
        
                    report->printExec();
                }
        
            }
        }
        

        I had created one pojo class for getter setter method.

        M Offline
        M Offline
        Mahesh Arrajella
        wrote on last edited by
        #4

        @Neel-0 where can i get the full source code

        A 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Hi,

          Using the answer to a simple query.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • M Mahesh Arrajella

            @Neel-0 where can i get the full source code

            A Offline
            A Offline
            aliks-os
            wrote on last edited by
            #6

            @Mahesh-Arrajella The official web site of QtRPT project here http://www.qtrpt.tk

            aha_1980A 1 Reply Last reply
            0
            • A aliks-os

              @Mahesh-Arrajella The official web site of QtRPT project here http://www.qtrpt.tk

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #7

              @aliks-os

              http://www.qtrpt.tk

              I cannot connect to this site...

              Qt has to stay free or it will die.

              A 1 Reply Last reply
              0
              • N Neel 0

                Hello,
                This problem is solved.

                here is the right code.

                void MainWindow::on_btnGenrateReport_clicked()
                {
                    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
                    db.setDatabaseName("/home/gtek/Work/validscan_proj/validscan_db");
                    if(!db.open())
                    {
                        qDebug()<<"Database not Open"<<endl;
                    }
                    else
                    {
                        QSqlQuery  qry;
                        qry.prepare("select * from vs_channel");
                        if(!qry.exec())
                        {
                            qDebug()<<"Error in Query"<<endl;
                        }
                        else
                        {
                            QtRPT *report = new QtRPT(this);
                            while(qry.next())
                            {
                               p = new pojo();
                               p->setChannel_id(qry.value(12).toString());
                               p->setChannel_tag(qry.value(1).toString());
                               p->setUnit(qry.value(6).toString());
                
                                plist.push_back(p);
                           }
                
                            report->loadReport(":/chreport.xml");
                            report->recordCount.append(plist.count());
                           
                
                           connect(report,&QtRPT::setValue,[&](const int recNo,
                                        const QString paramName, QVariant &paramValue, const int reportPage)
                            {
                                (void) reportPage;
                                if(paramName=="channel_id")
                                {
                                    paramValue=plist[recNo]->getChannel_id();
                
                                }
                                if(paramName=="channel_tag")
                                {
                                    paramValue=plist[recNo]->getChannel_tag();
                                }
                                if(paramName=="unit")
                                {
                                    paramValue=plist[recNo]->getUnit();
                                }
                
                            });
                
                          
                
                            report->printExec();
                        }
                
                    }
                }
                

                I had created one pojo class for getter setter method.

                Ketan__Patel__0011K Offline
                Ketan__Patel__0011K Offline
                Ketan__Patel__0011
                wrote on last edited by
                #8

                @Neel-0 Hey Bro Can You Share This Code ?

                I am working on Report from the last three Days

                help Me Brother

                1 Reply Last reply
                0
                • SGaistS SGaist

                  Hi,

                  QtRPT is not an official Qt module, so you should try contacting its author or use their forum.

                  In any case, you should also explain exactly what you are expecting and what you are getting.

                  ali-aydinA Offline
                  ali-aydinA Offline
                  ali-aydin
                  wrote on last edited by
                  #9

                  @SGaist
                  so what is the official Qt module for reporting?
                  reporting from data in SQL.

                  SGaistS 1 Reply Last reply
                  0
                  • ali-aydinA ali-aydin

                    @SGaist
                    so what is the official Qt module for reporting?
                    reporting from data in SQL.

                    SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @ali-aydin there are none officially provided by the Qt Company. QtRpt is one well known. AFAIK, they have moved their website.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    ali-aydinA 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      @ali-aydin there are none officially provided by the Qt Company. QtRpt is one well known. AFAIK, they have moved their website.

                      ali-aydinA Offline
                      ali-aydinA Offline
                      ali-aydin
                      wrote on last edited by
                      #11

                      @SGaist
                      when I using the QtRpt it does not work
                      I read that's manually but something is wrong and i can't find that
                      Errot like this :
                      sub-QtRptDesigner-qmake-all] Error2

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        That's not enough information. Please open your own thread about that issue and provide complete information like Qt version used, platform, QtRpt version and full error output.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        ali-aydinA 1 Reply Last reply
                        0
                        • aha_1980A aha_1980

                          @aliks-os

                          http://www.qtrpt.tk

                          I cannot connect to this site...

                          A Offline
                          A Offline
                          aliks-os
                          wrote on last edited by
                          #13

                          @aha_1980 Unfortunately the link http://www.qtrpt.tk is no more working.
                          To get official source of the project please use
                          https://sourceforge.net/p/qtrpt/discussion/general/

                          1 Reply Last reply
                          2

                          • Login

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