1
Discussion | Обсуждение / Re: Вопрос по работе с SubDetailBand
« on: April 05, 2024, 11:24:54 am »
Спасибо.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
------
std::unique_ptr<QSqlQuery> _query;
std::unique_ptr<QSqlQuery> _query_sub;
QSqlDatabase _db;
------
_query = std::make_unique<QSqlQuery>( _db );
_query->prepare( "select * from tab1");
_query->exec();
QSqlQueryModel* customersModel = new QSqlQueryModel();
customersModel->setQuery( *_query );
_reportEngine->dataManager()->addModel( "tab1", customersModel, true );
_query_sub = std::make_unique<QSqlQuery>(_db);
_query_sub->prepare( "select * from tab2 where tab2.id == "$D{tab1.id}");
_query_sub->exec();
QSqlQueryModel* customersModelSub = new QSqlQueryModel();
customersModelSub->setQuery(*_query_sub);
_reportEngine->dataManager()->addModel("tab2", customersModelSub, false);