D
D
Dmitry Burnashev2019-04-30 07:07:31
SQLite
Dmitry Burnashev, 2019-04-30 07:07:31

How to display dynamic parameters from a database table?

Introductory: a program for weighing products is required, cross-platform (Linux, Windows, android, etc.), the following tables are needed in the database:
Products, Weighing, Product parameters, Scale operator.
Each product has its own set of parameters, which can be changed dynamically.
Display a summary table of weights for products, i.e. in the heading the product, then its weighing.
In each line of weighing, the values ​​of the parameters of the corresponding product must be indicated, and in the column headings - the names of these parameters.
I made the following tables in the database (synchronization is carried out programmatically):
WeighingParameters
Id | Weighing | Parameter | Value
ProductParameters
Id | product | Parameter
Weighing
id | product | operator | datetime | Weight
Output a table like
Id | product | operator | datetime | Weight | (and here are the parameter columns for the selected product)
I plan to use QSqlQueryModel in conjunction with QTableView, but I can’t make an sql query to get the last table.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Tsvetkov, 2019-04-30
@dilepremon

PIVOT .
To display a non-persistent list of attributes, you can use a table view:
or:
5cc808ee2c0f7926631262.png

I
idShura, 2019-04-30
@idShura

The database is incorrectly designed, if you do not fix it now, then there will be problems.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question